diff options
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | CHANGES.rst | 24 | ||||
-rw-r--r-- | appveyor.yml | 2 | ||||
-rw-r--r-- | conftest.py | 23 | ||||
-rw-r--r-- | pkg_resources/__init__.py | 6 | ||||
-rwxr-xr-x | setup.cfg | 2 | ||||
-rwxr-xr-x | setup.py | 6 | ||||
-rwxr-xr-x | setuptools/command/egg_info.py | 11 | ||||
-rwxr-xr-x | setuptools/sandbox.py | 8 | ||||
-rw-r--r-- | setuptools/tests/namespaces.py | 42 | ||||
-rw-r--r-- | setuptools/tests/test_egg_info.py | 11 | ||||
-rw-r--r-- | setuptools/tests/test_namespaces.py | 52 | ||||
-rw-r--r-- | setuptools/tests/test_sandbox.py | 16 | ||||
-rw-r--r-- | tox.ini | 2 |
14 files changed, 165 insertions, 43 deletions
diff --git a/.travis.yml b/.travis.yml index 006316d1..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 @@ -24,8 +23,6 @@ script: #- python -m tox - tox -before_deploy: - - export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=1 deploy: provider: pypi # Also update server in setup.cfg diff --git a/CHANGES.rst b/CHANGES.rst index 2dc68e71..16cc06be 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,30 @@ CHANGES ======= +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. + +v29.0.1 +------- + +* #861: Re-release of v29.0.1 with the executable script + launchers bundled. Now, launchers are included by default + and users that want to disable this behavior must set the + environment variable + 'SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES' to + a false value like "false" or "0". + +v29.0.0 +------- + +* #841: Drop special exception for packages invoking + win32com during the build/install process. See + Distribute #118 for history. + v28.8.0 ------- diff --git a/appveyor.yml b/appveyor.yml index 299c35b7..9313a482 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,7 @@ environment: + APPVEYOR: true + matrix: - PYTHON: "C:\\Python35-x64" - PYTHON: "C:\\Python27-x64" 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/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 = 28.8.0 +current_version = 29.0.1 commit = True tag = True @@ -54,8 +54,8 @@ package_data = dict( ) force_windows_specific_files = ( - os.environ.get("SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES") - not in (None, "", "0") + os.environ.get("SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES", "1").lower() + not in ("", "0", "false", "no") ) include_windows_files = ( @@ -85,7 +85,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="28.8.0", + version="29.0.1", 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..6f8fd874 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -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/sandbox.py b/setuptools/sandbox.py index 39afd57e..d882d715 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -373,14 +373,6 @@ if hasattr(os, 'devnull'): else: _EXCEPTIONS = [] -try: - from win32com.client.gencache import GetGeneratePath - _EXCEPTIONS.append(GetGeneratePath()) - del GetGeneratePath -except ImportError: - # it appears pywin32 is not installed, so no need to exclude. - pass - class DirectorySandbox(AbstractSandbox): """Restrict operations to a single subdirectory - pseudo-chroot""" diff --git a/setuptools/tests/namespaces.py b/setuptools/tests/namespaces.py new file mode 100644 index 00000000..ef5ecdad --- /dev/null +++ b/setuptools/tests/namespaces.py @@ -0,0 +1,42 @@ +from __future__ import absolute_import, unicode_literals + +import textwrap + + +def build_namespace_package(tmpdir, name): + src_dir = tmpdir / name + src_dir.mkdir() + setup_py = src_dir / 'setup.py' + namespace, sep, rest = name.partition('.') + script = textwrap.dedent(""" + import setuptools + setuptools.setup( + name={name!r}, + version="1.0", + namespace_packages=[{namespace!r}], + packages=[{namespace!r}], + ) + """).format(**locals()) + setup_py.write_text(script, encoding='utf-8') + ns_pkg_dir = src_dir / namespace + ns_pkg_dir.mkdir() + pkg_init = ns_pkg_dir / '__init__.py' + tmpl = '__import__("pkg_resources").declare_namespace({namespace!r})' + decl = tmpl.format(**locals()) + pkg_init.write_text(decl, encoding='utf-8') + pkg_mod = ns_pkg_dir / (rest + '.py') + some_functionality = 'name = {rest!r}'.format(**locals()) + pkg_mod.write_text(some_functionality, encoding='utf-8') + return src_dir + + +def make_site_dir(target): + """ + Add a sitecustomize.py module in target to cause + target to be added to site dirs such that .pth files + are processed there. + """ + sc = target / 'sitecustomize.py' + target_str = str(target) + tmpl = '__import__("site").addsitedir({target_str!r})' + sc.write_text(tmpl.format(**locals()), encoding='utf-8') 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_namespaces.py b/setuptools/tests/test_namespaces.py new file mode 100644 index 00000000..2d44ad86 --- /dev/null +++ b/setuptools/tests/test_namespaces.py @@ -0,0 +1,52 @@ +from __future__ import absolute_import, unicode_literals + +import os +import sys +import subprocess + +import pytest + +from . import namespaces + + +class TestNamespaces: + + @pytest.mark.xfail(sys.version_info < (3, 3), + reason="Requires PEP 420") + @pytest.mark.skipif(os.environ.get("APPVEYOR"), + reason="https://github.com/pypa/setuptools/issues/851") + def test_mixed_site_and_non_site(self, tmpdir): + """ + Installing two packages sharing the same namespace, one installed + to a site dir and the other installed just to a path on PYTHONPATH + should leave the namespace in tact and both packages reachable by + import. + """ + pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA') + pkg_B = namespaces.build_namespace_package(tmpdir, 'myns.pkgB') + site_packages = tmpdir / 'site-packages' + path_packages = tmpdir / 'path-packages' + targets = site_packages, path_packages + python_path = os.pathsep.join(map(str, targets)) + # use pip to install to the target directory + install_cmd = [ + 'pip', + 'install', + str(pkg_A), + '-t', str(site_packages), + ] + subprocess.check_call(install_cmd) + namespaces.make_site_dir(site_packages) + install_cmd = [ + 'pip', + 'install', + str(pkg_B), + '-t', str(path_packages), + ] + subprocess.check_call(install_cmd) + try_import = [ + sys.executable, + '-c', 'import myns.pkgA; import myns.pkgB', + ] + env = dict(PYTHONPATH=python_path) + subprocess.check_call(try_import, env=env) diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index b92a477a..929f0a5b 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -23,22 +23,6 @@ class TestSandbox: return do_write - def test_win32com(self, tmpdir): - """ - win32com should not be prevented from caching COM interfaces - in gen_py. - """ - win32com = pytest.importorskip('win32com') - gen_py = win32com.__gen_path__ - target = os.path.join(gen_py, 'test_write') - sandbox = DirectorySandbox(str(tmpdir)) - try: - # attempt to create gen_py file - sandbox.run(self._file_writer(target)) - finally: - if os.path.exists(target): - os.remove(target) - def test_setup_py_with_BOM(self): """ It should be possible to execute a setup.py with a Byte Order Mark @@ -1,4 +1,4 @@ [testenv] deps=-rtests/requirements.txt -passenv=APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir +passenv=APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir APPVEYOR commands=python -m pytest {posargs:-rsx} |