From: DongHun Kwak Date: Mon, 14 Jan 2019 01:32:20 +0000 (+0900) Subject: Imported Upstream version 35.0.2 X-Git-Tag: upstream/35.0.2^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6cb62b7dc7e312d28ce9076920ad7f04d1d1a4ab;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 35.0.2 --- diff --git a/.travis.yml b/.travis.yml index fd18a33..adb2f94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,6 @@ matrix: env: LC_ALL=C LC_CTYPE=C - python: 2.7 env: LC_ALL=C LC_CTYPE=C - allow_failures: - # https://github.com/pypa/setuptools/issues/1015 - - python: nightly script: # need tox and rwt to get started - pip install tox rwt diff --git a/CHANGES.rst b/CHANGES.rst index ebd1836..1ac719d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v35.0.2 +------- + +* #1015: Fix test failures on Python 3.7. + +* #1024: Add workaround for Jython #2581 in monkey module. + v35.0.1 ------- diff --git a/setup.cfg b/setup.cfg index da62ac4..cb247aa 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 35.0.1 +current_version = 35.0.2 commit = True tag = True diff --git a/setup.py b/setup.py index df73251..0d465cc 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="35.0.1", + version="35.0.2", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 1a6ea9c..151e495 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -112,7 +112,8 @@ def translate_pattern(glob): if not last_chunk: pat += sep - return re.compile(pat + r'\Z(?ms)') + pat += r'\Z' + return re.compile(pat, flags=re.MULTILINE|re.DOTALL) class egg_info(Command): diff --git a/setuptools/monkey.py b/setuptools/monkey.py index 68fad9d..acd0a4f 100644 --- a/setuptools/monkey.py +++ b/setuptools/monkey.py @@ -21,6 +21,20 @@ if you think you need this functionality. """ +def _get_mro(cls): + """ + Returns the bases classes for cls sorted by the MRO. + + Works around an issue on Jython where inspect.getmro will not return all + base classes if multiple classes share the same name. Instead, this + function will return a tuple containing the class itself, and the contents + of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024. + """ + if platform.python_implementation() == "Jython": + return (cls,) + cls.__bases__ + return inspect.getmro(cls) + + def get_unpatched(item): lookup = ( get_unpatched_class if isinstance(item, six.class_types) else @@ -38,7 +52,7 @@ def get_unpatched_class(cls): """ external_bases = ( cls - for cls in inspect.getmro(cls) + for cls in _get_mro(cls) if not cls.__module__.startswith('setuptools') ) base = next(external_bases) diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py index 3b34c88..28cbca1 100644 --- a/setuptools/tests/test_manifest.py +++ b/setuptools/tests/test_manifest.py @@ -6,6 +6,7 @@ import os import shutil import sys import tempfile +import itertools from distutils import log from distutils.errors import DistutilsTemplateError @@ -65,32 +66,94 @@ default_files = frozenset(map(make_local_path, [ ])) -def get_pattern(glob): - return translate_pattern(make_local_path(glob)).pattern - - -def test_translated_pattern_test(): - l = make_local_path - assert get_pattern('foo') == r'foo\Z(?ms)' - assert get_pattern(l('foo/bar')) == l(r'foo\/bar\Z(?ms)') +translate_specs = [ + ('foo', ['foo'], ['bar', 'foobar']), + ('foo/bar', ['foo/bar'], ['foo/bar/baz', './foo/bar', 'foo']), # Glob matching - assert get_pattern('*.txt') == l(r'[^\/]*\.txt\Z(?ms)') - assert get_pattern('dir/*.txt') == l(r'dir\/[^\/]*\.txt\Z(?ms)') - assert get_pattern('*/*.py') == l(r'[^\/]*\/[^\/]*\.py\Z(?ms)') - assert get_pattern('docs/page-?.txt') \ - == l(r'docs\/page\-[^\/]\.txt\Z(?ms)') + ('*.txt', ['foo.txt', 'bar.txt'], ['foo/foo.txt']), + ('dir/*.txt', ['dir/foo.txt', 'dir/bar.txt', 'dir/.txt'], ['notdir/foo.txt']), + ('*/*.py', ['bin/start.py'], []), + ('docs/page-?.txt', ['docs/page-9.txt'], ['docs/page-10.txt']), # Globstars change what they mean depending upon where they are - assert get_pattern(l('foo/**/bar')) == l(r'foo\/(?:[^\/]+\/)*bar\Z(?ms)') - assert get_pattern(l('foo/**')) == l(r'foo\/.*\Z(?ms)') - assert get_pattern(l('**')) == r'.*\Z(?ms)' + ( + 'foo/**/bar', + ['foo/bing/bar', 'foo/bing/bang/bar', 'foo/bar'], + ['foo/abar'], + ), + ( + 'foo/**', + ['foo/bar/bing.py', 'foo/x'], + ['/foo/x'], + ), + ( + '**', + ['x', 'abc/xyz', '@nything'], + [], + ), # Character classes - assert get_pattern('pre[one]post') == r'pre[one]post\Z(?ms)' - assert get_pattern('hello[!one]world') == r'hello[^one]world\Z(?ms)' - assert get_pattern('[]one].txt') == r'[\]one]\.txt\Z(?ms)' - assert get_pattern('foo[!]one]bar') == r'foo[^\]one]bar\Z(?ms)' + ( + 'pre[one]post', + ['preopost', 'prenpost', 'preepost'], + ['prepost', 'preonepost'], + ), + + ( + 'hello[!one]world', + ['helloxworld', 'helloyworld'], + ['hellooworld', 'helloworld', 'hellooneworld'], + ), + + ( + '[]one].txt', + ['o.txt', '].txt', 'e.txt'], + ['one].txt'], + ), + + ( + 'foo[!]one]bar', + ['fooybar'], + ['foo]bar', 'fooobar', 'fooebar'], + ), + +] +""" +A spec of inputs for 'translate_pattern' and matches and mismatches +for that input. +""" + +match_params = itertools.chain.from_iterable( + zip(itertools.repeat(pattern), matches) + for pattern, matches, mismatches in translate_specs +) + + +@pytest.fixture(params=match_params) +def pattern_match(request): + return map(make_local_path, request.param) + + +mismatch_params = itertools.chain.from_iterable( + zip(itertools.repeat(pattern), mismatches) + for pattern, matches, mismatches in translate_specs +) + + +@pytest.fixture(params=mismatch_params) +def pattern_mismatch(request): + return map(make_local_path, request.param) + + +def test_translated_pattern_match(pattern_match): + pattern, target = pattern_match + assert translate_pattern(pattern).match(target) + + +def test_translated_pattern_mismatch(pattern_mismatch): + pattern, target = pattern_mismatch + assert not translate_pattern(pattern).match(target) class TempDirTestCase(object):