diff options
author | idle sign <idlesign@yandex.ru> | 2016-12-03 22:11:21 +0700 |
---|---|---|
committer | idle sign <idlesign@yandex.ru> | 2016-12-03 22:11:21 +0700 |
commit | 06715b636916cd0a008a973d7a7cdcd16fc2feeb (patch) | |
tree | 88beab9724593e082cae5b599558a5cf19823596 | |
parent | ef583b282b179d46b9e9066e5714d1d37aeaff3b (diff) | |
parent | aac9f9f31c0fdb97c52e343be6b8a641b2341232 (diff) | |
download | external_python_setuptools-06715b636916cd0a008a973d7a7cdcd16fc2feeb.tar.gz external_python_setuptools-06715b636916cd0a008a973d7a7cdcd16fc2feeb.tar.bz2 external_python_setuptools-06715b636916cd0a008a973d7a7cdcd16fc2feeb.zip |
Merge branch 'remote_pypa_master' into feat/setupcfg_handling
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | CHANGES.rst | 24 | ||||
-rw-r--r-- | conftest.py | 23 | ||||
-rw-r--r-- | docs/pkg_resources.txt | 11 | ||||
-rw-r--r-- | pkg_resources/__init__.py | 6 | ||||
-rwxr-xr-x | setup.cfg | 2 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rwxr-xr-x | setuptools/command/egg_info.py | 15 | ||||
-rwxr-xr-x | setuptools/command/sdist.py | 10 | ||||
-rwxr-xr-x | setuptools/package_index.py | 2 | ||||
-rw-r--r-- | setuptools/tests/test_egg_info.py | 11 | ||||
-rw-r--r-- | setuptools/tests/test_manifest.py | 12 | ||||
-rw-r--r-- | setuptools/tests/test_namespaces.py | 2 | ||||
-rw-r--r-- | setuptools/tests/test_sdist.py | 9 |
14 files changed, 100 insertions, 30 deletions
diff --git a/.travis.yml b/.travis.yml index 30b69a69..2f9b6a7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ python: - "3.6-dev" - nightly - pypy - - pypy3 env: - "" - LC_ALL=C LC_CTYPE=C diff --git a/CHANGES.rst b/CHANGES.rst index 99041cde..096d77bf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,24 @@ -======= -CHANGES -======= +v30.1.0 +------- + +* #846: Also trap 'socket.error' when opening URLs in + package_index. + +* #849: Manifest processing now matches the filename + pattern anywhere in the filename and not just at the + start. Restores behavior found prior to 28.5.0. + +v30.0.0 +------- + +* #864: Drop support for Python 3.2. Systems requiring + Python 3.2 support must use 'setuptools < 30'. + +* #825: Suppress warnings for single files. + +* #830 via #843: Once again restored inclusion of data + files to sdists, but now trap TypeError caused by + techniques employed rjsmin and similar. v29.0.1 ------- diff --git a/conftest.py b/conftest.py index 47a5d888..0da92be9 100644 --- a/conftest.py +++ b/conftest.py @@ -1,8 +1,25 @@ -import pytest +import os + pytest_plugins = 'setuptools.tests.fixtures' + def pytest_addoption(parser): - parser.addoption("--package_name", action="append", default=[], - help="list of package_name to pass to test functions") + parser.addoption( + "--package_name", action="append", default=[], + help="list of package_name to pass to test functions", + ) + + +def pytest_configure(): + _issue_852_workaround() + +def _issue_852_workaround(): + """ + Patch 'setuptools.__file__' with an absolute path + for forward compatibility with Python 3. + Workaround for https://github.com/pypa/setuptools/issues/852 + """ + setuptools = __import__('setuptools') + setuptools.__file__ = os.path.abspath(setuptools.__file__) diff --git a/docs/pkg_resources.txt b/docs/pkg_resources.txt index 7b979ec3..e8412b33 100644 --- a/docs/pkg_resources.txt +++ b/docs/pkg_resources.txt @@ -831,10 +831,9 @@ correspond exactly to the constructor argument names: ``name``, ``module_name``, ``attrs``, ``extras``, and ``dist`` are all available. In addition, the following methods are provided: -``load(require=True, env=None, installer=None)`` - Load the entry point, returning the advertised Python object, or raise - ``ImportError`` if it cannot be obtained. If `require` is a true value, - then ``require(env, installer)`` is called before attempting the import. +``load()`` + Load the entry point, returning the advertised Python object. Effectively + calls ``self.require()`` then returns ``self.resolve()``. ``require(env=None, installer=None)`` Ensure that any "extras" needed by the entry point are available on @@ -846,6 +845,10 @@ addition, the following methods are provided: taking a ``Requirement`` instance and returning a matching importable ``Distribution`` instance or None. +``resolve()`` + Resolve the entry point from its module and attrs, returning the advertised + Python object. Raises ``ImportError`` if it cannot be obtained. + ``__str__()`` The string form of an ``EntryPoint`` is a string that could be passed to ``EntryPoint.parse()`` to produce an equivalent ``EntryPoint``. diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index a323857c..dd561d2b 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -75,11 +75,7 @@ __import__('pkg_resources.extern.packaging.requirements') __import__('pkg_resources.extern.packaging.markers') if (3, 0) < sys.version_info < (3, 3): - msg = ( - "Support for Python 3.0-3.2 has been dropped. Future versions " - "will fail here." - ) - warnings.warn(msg) + raise RuntimeError("Python 3.3 or later is required") # declare some globals that will be defined later to # satisfy the linters. @@ -1,5 +1,5 @@ [bumpversion] -current_version = 29.0.1 +current_version = 30.0.0 commit = True tag = True @@ -85,7 +85,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="29.0.1", + version="30.0.0", 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 6cc8f4c4..8a06e496 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -457,7 +457,7 @@ class FileList(_FileList): """ if self.allfiles is None: self.findall() - match = translate_pattern(os.path.join('**', pattern)) + match = translate_pattern(os.path.join('**', '*' + pattern)) found = [f for f in self.allfiles if match.match(f)] self.extend(found) return bool(found) @@ -466,7 +466,7 @@ class FileList(_FileList): """ Exclude all files anywhere that match the pattern. """ - match = translate_pattern(os.path.join('**', pattern)) + match = translate_pattern(os.path.join('**', '*' + pattern)) return self._remove_files(match.match) def append(self, item): @@ -554,10 +554,17 @@ class manifest_maker(sdist): msg = "writing manifest file '%s'" % self.manifest self.execute(write_file, (self.manifest, files), msg) - def warn(self, msg): # suppress missing-file warnings from sdist - if not msg.startswith("standard file not found:"): + def warn(self, msg): + if not self._should_suppress_warning(msg): sdist.warn(self, msg) + @staticmethod + def _should_suppress_warning(msg): + """ + suppress missing-file warnings from sdist + """ + return re.match(r"standard file .*not found", msg) + def add_defaults(self): sdist.add_defaults(self) self.filelist.append(self.template) diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 9975753d..84e29a1b 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -142,9 +142,13 @@ class sdist(sdist_add_defaults, orig.sdist): for filename in filenames]) def _add_defaults_data_files(self): - """ - Don't add any data files, but why? - """ + try: + if six.PY2: + sdist_add_defaults._add_defaults_data_files(self) + else: + super()._add_defaults_data_files() + except TypeError: + log.warn("data_files contains unexpected objects") def check_readme(self): for f in self.READMES: diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 024fab98..d80d43bc 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -768,7 +768,7 @@ class PackageIndex(Environment): 'down, %s' % (url, v.line) ) - except http_client.HTTPException as v: + except (http_client.HTTPException, socket.error) as v: if warning: self.warn(warning, v) else: diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 12c10497..dc41bc1f 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -4,7 +4,7 @@ import re import stat import sys -from setuptools.command.egg_info import egg_info +from setuptools.command.egg_info import egg_info, manifest_maker from setuptools.dist import Distribution from setuptools.extern.six.moves import map @@ -237,6 +237,15 @@ class TestEggInfo(object): pkginfo = os.path.join(egg_info_dir, 'PKG-INFO') assert 'Requires-Python: >=1.2.3' in open(pkginfo).read().split('\n') + def test_manifest_maker_warning_suppresion(self): + fixtures = [ + "standard file not found: should have one of foo.py, bar.py", + "standard file 'setup.py' not found" + ] + + for msg in fixtures: + assert manifest_maker._should_suppress_warning(msg) + def _run_install_command(self, tmpdir_cwd, env, cmd=None, output=None): environ = os.environ.copy().update( HOME=env.paths['home'], diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py index 602c43a2..62b6d708 100644 --- a/setuptools/tests/test_manifest.py +++ b/setuptools/tests/test_manifest.py @@ -449,6 +449,11 @@ class TestFileListTest(TempDirTestCase): assert file_list.files == ['a.py', l('d/c.py')] self.assertWarnings() + file_list.process_template_line('global-include .txt') + file_list.sort() + assert file_list.files == ['a.py', 'b.txt', l('d/c.py')] + self.assertNoWarnings() + def test_global_exclude(self): l = make_local_path # global-exclude @@ -465,6 +470,13 @@ class TestFileListTest(TempDirTestCase): assert file_list.files == ['b.txt'] self.assertWarnings() + file_list = FileList() + file_list.files = ['a.py', 'b.txt', l('d/c.pyc'), 'e.pyo'] + file_list.process_template_line('global-exclude .py[co]') + file_list.sort() + assert file_list.files == ['a.py', 'b.txt'] + self.assertNoWarnings() + def test_recursive_include(self): l = make_local_path # recursive-include diff --git a/setuptools/tests/test_namespaces.py b/setuptools/tests/test_namespaces.py index 2d44ad86..28c5e9de 100644 --- a/setuptools/tests/test_namespaces.py +++ b/setuptools/tests/test_namespaces.py @@ -13,7 +13,7 @@ class TestNamespaces: @pytest.mark.xfail(sys.version_info < (3, 3), reason="Requires PEP 420") - @pytest.mark.skipif(os.environ.get("APPVEYOR"), + @pytest.mark.skipif(bool(os.environ.get("APPVEYOR")), reason="https://github.com/pypa/setuptools/issues/851") def test_mixed_site_and_non_site(self, tmpdir): """ diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py index 609c7830..f34068dc 100644 --- a/setuptools/tests/test_sdist.py +++ b/setuptools/tests/test_sdist.py @@ -26,7 +26,8 @@ SETUP_ATTRS = { 'name': 'sdist_test', 'version': '0.0', 'packages': ['sdist_test'], - 'package_data': {'sdist_test': ['*.txt']} + 'package_data': {'sdist_test': ['*.txt']}, + 'data_files': [("data", [os.path.join("d", "e.dat")])], } SETUP_PY = """\ @@ -95,9 +96,12 @@ class TestSdistTest: # Set up the rest of the test package test_pkg = os.path.join(self.temp_dir, 'sdist_test') os.mkdir(test_pkg) + data_folder = os.path.join(self.temp_dir, "d") + os.mkdir(data_folder) # *.rst was not included in package_data, so c.rst should not be # automatically added to the manifest when not under version control - for fname in ['__init__.py', 'a.txt', 'b.txt', 'c.rst']: + for fname in ['__init__.py', 'a.txt', 'b.txt', 'c.rst', + os.path.join(data_folder, "e.dat")]: # Just touch the files; their contents are irrelevant open(os.path.join(test_pkg, fname), 'w').close() @@ -126,6 +130,7 @@ class TestSdistTest: assert os.path.join('sdist_test', 'a.txt') in manifest assert os.path.join('sdist_test', 'b.txt') in manifest assert os.path.join('sdist_test', 'c.rst') not in manifest + assert os.path.join('d', 'e.dat') in manifest def test_defaults_case_sensitivity(self): """ |