From 5d58d955b5f5dcafe6ec624b82b327ce1fe9bbfd Mon Sep 17 00:00:00 2001 From: david Date: Wed, 25 Jun 2014 10:47:59 -0400 Subject: fix failing integration (test_stevedore) test on windows because of an unreleased handle on the current directory --- setuptools/tests/test_integration.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index 7144aa6c..8d6c1e55 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -25,6 +25,9 @@ def install_context(request, tmpdir, monkeypatch): install_dir = tmpdir.mkdir('install_dir') def fin(): + # undo the monkeypatch, particularly needed under + # windows because of kept handle on cwd + monkeypatch.undo() new_cwd.remove() user_base.remove() user_site.remove() -- cgit v1.2.1 From e221bdf38ccf35d0d2b1148b4072108fcd47ec0a Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sun, 29 Jun 2014 14:58:41 +0200 Subject: Fix typos --- setuptools/tests/win_script_wrapper.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setuptools/tests/win_script_wrapper.txt b/setuptools/tests/win_script_wrapper.txt index 731243dd..b3a52e0a 100644 --- a/setuptools/tests/win_script_wrapper.txt +++ b/setuptools/tests/win_script_wrapper.txt @@ -3,7 +3,7 @@ Python Script Wrapper for Windows setuptools includes wrappers for Python scripts that allows them to be executed like regular windows programs. There are 2 wrappers, once -for command-line programs, cli.exe, and one for graphica programs, +for command-line programs, cli.exe, and one for graphical programs, gui.exe. These programs are almost identical, function pretty much the same way, and are generated from the same source file. The wrapper programs are used by copying them to the directory containing @@ -44,7 +44,7 @@ We'll also copy cli.exe to the sample-directory with the name foo.exe: When the copy of cli.exe, foo.exe in this example, runs, it examines the path name it was run with and computes a Python script path name -by removing the '.exe' suffic and adding the '-script.py' suffix. (For +by removing the '.exe' suffix and adding the '-script.py' suffix. (For GUI programs, the suffix '-script-pyw' is added.) This is why we named out script the way we did. Now we can run out script by running the wrapper: @@ -68,8 +68,8 @@ This example was a little pathological in that it exercised windows - Double quotes in strings need to be escaped by preceding them with back slashes. -- One or more backslashes preceding double quotes quotes need to be - escaped by preceding each of them them with back slashes. +- One or more backslashes preceding double quotes need to be escaped + by preceding each of them with back slashes. Specifying Python Command-line Options -- cgit v1.2.1 From 721f392408ac0de7dd8e77afe8ed6c1f020b6416 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sun, 29 Jun 2014 15:23:29 +0200 Subject: Fixed capitalization of "Bitbucket" Bitbucket is normally spelled with exactly one capital "b". --- docs/merge-faq.txt | 2 +- docs/releases.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/merge-faq.txt b/docs/merge-faq.txt index 52013098..ea45f30c 100644 --- a/docs/merge-faq.txt +++ b/docs/merge-faq.txt @@ -58,7 +58,7 @@ Who is invited to contribute? Who is excluded? While we've worked privately to initiate this merge due to the potential sensitivity of the topic, no one is excluded from this effort. We invite all members of the community, especially those most familiar with Python packaging and its challenges to join us in the effort. -We have lots of ideas for how we'd like to improve the codebase, release process, everything. Like distribute, the post-merge setuptools will have its source hosted on bitbucket. (So if you're currently a distribute contributor, about the only thing that's going to change is the URL of the repository you follow.) Also like distribute, it'll support Python 3, and hopefully we'll soon merge Vinay Sajip's patches to make it run on Python 3 without needing 2to3 to be run on the code first. +We have lots of ideas for how we'd like to improve the codebase, release process, everything. Like distribute, the post-merge setuptools will have its source hosted on Bitbucket. (So if you're currently a distribute contributor, about the only thing that's going to change is the URL of the repository you follow.) Also like distribute, it'll support Python 3, and hopefully we'll soon merge Vinay Sajip's patches to make it run on Python 3 without needing 2to3 to be run on the code first. While we've worked privately to initiate this merge due to the potential sensitivity of the topic, no one is excluded from this effort. We invite all members of the community, especially those most familiar with Python packaging and its challenges to join us in the effort. diff --git a/docs/releases.txt b/docs/releases.txt index 41a814bc..66c0896f 100644 --- a/docs/releases.txt +++ b/docs/releases.txt @@ -10,7 +10,7 @@ module. The script does some checks (some interactive) and fully automates the release process. A Setuptools release manager must have maintainer access on PyPI to the -project and administrative access to the BitBucket project. +project and administrative access to the Bitbucket project. To make a release, run the following from a Mercurial checkout at the revision slated for release:: -- cgit v1.2.1 From d1e6671ef6f2cc89df210122a4e5e67fa6e2c321 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sun, 29 Jun 2014 15:24:33 +0200 Subject: Spell check documentation --- docs/easy_install.txt | 8 ++++---- docs/formats.txt | 4 ++-- docs/pkg_resources.txt | 6 +++--- docs/python3.txt | 2 +- docs/setuptools.txt | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/easy_install.txt b/docs/easy_install.txt index 6739ba16..8dd176fd 100644 --- a/docs/easy_install.txt +++ b/docs/easy_install.txt @@ -39,7 +39,7 @@ You will need at least Python 2.6. An ``easy_install`` script will be installed in the normal location for Python scripts on your platform. Note that the instructions on the setuptools PyPI page assume that you are -are installling to Python's primary ``site-packages`` directory. If this is +are installing to Python's primary ``site-packages`` directory. If this is not the case, you should consult the section below on `Custom Installation Locations`_ before installing. (And, on Windows, you should not use the ``.exe`` installer when installing to an alternate location.) @@ -915,7 +915,7 @@ Command-Line Options domain. The glob patterns must match the *entire* user/host/port section of the target URL(s). For example, ``*.python.org`` will NOT accept a URL like ``http://python.org/foo`` or ``http://www.python.org:8080/``. - Multiple patterns can be specified by separting them with commas. The + Multiple patterns can be specified by separating them with commas. The default pattern is ``*``, which matches anything. In general, this option is mainly useful for blocking EasyInstall's web @@ -1014,7 +1014,7 @@ application, simply set the OS environment of that application to a specific val Use "virtualenv" ~~~~~~~~~~~~~~~~ "virtualenv" is a 3rd-party python package that effectively "clones" a python installation, thereby -creating an isolated location to intall packages. The evolution of "virtualenv" started before the existence +creating an isolated location to install packages. The evolution of "virtualenv" started before the existence of the User installation scheme. "virtualenv" provides a version of ``easy_install`` that is scoped to the cloned python install and is used in the normal way. "virtualenv" does offer various features that the User installation scheme alone does not provide, e.g. the ability to hide the main python site-packages. @@ -1171,7 +1171,7 @@ History * Fixed not HTML-decoding URLs scraped from web pages 0.6c5 - * Fixed ``.dll`` files on Cygwin not having executable permisions when an egg + * Fixed ``.dll`` files on Cygwin not having executable permissions when an egg is installed unzipped. 0.6c4 diff --git a/docs/formats.txt b/docs/formats.txt index 36954bef..5c461ecb 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -349,7 +349,7 @@ of the project's "traditional" scripts (i.e., those specified using the ``scripts`` keyword to ``setup()``). This is so that they can be reconstituted when an ``.egg`` file is installed. -The scripts are placed here using the disutils' standard +The scripts are placed here using the distutils' standard ``install_scripts`` command, so any ``#!`` lines reflect the Python installation where the egg was built. But instead of copying the scripts to the local script installation directory, EasyInstall writes @@ -595,7 +595,7 @@ order to one another that is defined by their ``PYTHONPATH`` and The net result of these changes is that ``sys.path`` order will be as follows at runtime: -1. The ``sys.argv[0]`` directory, or an emtpy string if no script +1. The ``sys.argv[0]`` directory, or an empty string if no script is being executed. 2. All eggs installed by EasyInstall in any ``.pth`` file in each diff --git a/docs/pkg_resources.txt b/docs/pkg_resources.txt index 18b68db7..f4a768e4 100644 --- a/docs/pkg_resources.txt +++ b/docs/pkg_resources.txt @@ -62,7 +62,7 @@ importable distribution pluggable distribution An importable distribution whose filename unambiguously identifies its - release (i.e. project and version), and whose contents unamabiguously + release (i.e. project and version), and whose contents unambiguously specify what releases of other projects will satisfy its runtime requirements. @@ -1434,7 +1434,7 @@ shown here. The `manager` argument to the methods below must be an object that supports the full `ResourceManager API`_ documented above. ``get_resource_filename(manager, resource_name)`` - Return a true filesystem path for `resource_name`, co-ordinating the + Return a true filesystem path for `resource_name`, coordinating the extraction with `manager`, if the resource must be unpacked to the filesystem. @@ -1586,7 +1586,7 @@ Parsing Utilities character is ``#`` are considered comment lines.) If `strs` is not an instance of ``basestring``, it is iterated over, and - each item is passed recursively to ``yield_lines()``, so that an arbitarily + each item is passed recursively to ``yield_lines()``, so that an arbitrarily nested sequence of strings, or sequences of sequences of strings can be flattened out to the lines contained therein. So for example, passing a file object or a list of strings to ``yield_lines`` will both work. diff --git a/docs/python3.txt b/docs/python3.txt index 1e019951..df173000 100644 --- a/docs/python3.txt +++ b/docs/python3.txt @@ -69,7 +69,7 @@ before you run the test command, as the files otherwise will seem updated, and no conversion will happen. In general, if code doesn't seem to be converted, deleting the build directory -and trying again is a good saferguard against the build directory getting +and trying again is a good safeguard against the build directory getting "out of sync" with the source directory. Distributing Python 3 modules diff --git a/docs/setuptools.txt b/docs/setuptools.txt index a793af53..86e23ff9 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -520,7 +520,7 @@ as the following:: } ) -Any eggs built from the above setup script will include a short excecutable +Any eggs built from the above setup script will include a short executable prelude that imports and calls ``main_func()`` from ``my_package.some_module``. The prelude can be run on Unix-like platforms (including Mac and Linux) by invoking the egg with ``/bin/sh``, or by enabling execute permissions on the @@ -2180,7 +2180,7 @@ for future builds (even those run implicitly by the ``install`` command):: setup.py build --compiler=mingw32 saveopts -The ``saveopts`` command saves all options for every commmand specified on the +The ``saveopts`` command saves all options for every command specified on the command line to the project's local ``setup.cfg`` file, unless you use one of the `configuration file options`_ to change where the options are saved. For example, this command does the same as above, but saves the compiler setting @@ -2350,7 +2350,7 @@ Note, by the way, that the metadata in your ``setup()`` call determines what will be listed in PyPI for your package. Try to fill out as much of it as possible, as it will save you a lot of trouble manually adding and updating your PyPI listings. Just put it in ``setup.py`` and use the ``register`` -comamnd to keep PyPI up to date. +command to keep PyPI up to date. The ``upload`` command has a few options worth noting: -- cgit v1.2.1 From bf0cecd76dd0501cbb98c77583c11a622dcfe73f Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Thu, 3 Jul 2014 17:03:39 +0300 Subject: ssl_support: Adjust to tunneling changes in Python 2.7.7 and 3.4.1. The fix for https://bugs.python.org/issue7776 changed httplib.HTTPConnection's handling of tunneling: `host' now points to the proxy host, so we have to adjust the code to perform the certificate validation on `_tunnel_host' instead when it is available. --- setuptools/ssl_support.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py index 7b5f429f..cc7db067 100644 --- a/setuptools/ssl_support.py +++ b/setuptools/ssl_support.py @@ -178,12 +178,19 @@ class VerifyingHTTPSConn(HTTPSConnection): if hasattr(self, '_tunnel') and getattr(self, '_tunnel_host', None): self.sock = sock self._tunnel() + # http://bugs.python.org/issue7776: Python>=3.4.1 and >=2.7.7 + # change self.host to mean the proxy server host when tunneling is + # being used. Adapt, since we are interested in the destination + # host for the match_hostname() comparison. + actual_host = self._tunnel_host + else: + actual_host = self.host self.sock = ssl.wrap_socket( sock, cert_reqs=ssl.CERT_REQUIRED, ca_certs=self.ca_bundle ) try: - match_hostname(self.sock.getpeercert(), self.host) + match_hostname(self.sock.getpeercert(), actual_host) except CertificateError: self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() -- cgit v1.2.1 From e66c4d9c3aefaf98a7d8d9b19ce5948fe7840c49 Mon Sep 17 00:00:00 2001 From: Melvyn Sopacua Date: Sat, 5 Jul 2014 17:43:39 +0200 Subject: Fix exclude list on python 3.2+ imp.get_tag() is only available on 3.2+. Since 2 Date: Sat, 5 Jul 2014 18:41:12 +0200 Subject: Commit the fix we did when testing python3 I shall `hg status` before submitting PRs. I shall `hg status` before submitting PRs. I shall `hg status` before submitting PRs. --- setuptools/command/install_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index cf5375f6..7692e0f3 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -18,7 +18,7 @@ class install_lib(orig.install_lib): .single_version_externally_managed) exclude_names = ['__init__.py', '__init__.pyc', '__init__.pyo'] if hasattr(imp, 'get_tag') : - exclude_names.extend( + exclude_names.extend(( os.path.join( '__pycache__', '__init__.' + imp.get_tag() + '.pyc' @@ -27,7 +27,7 @@ class install_lib(orig.install_lib): '__pycache__', '__init__.' + imp.get_tag() + '.pyo' ), - ) + )) if svem: for pkg in nsp: parts = pkg.split('.') -- cgit v1.2.1 From 0d6a21f045a6137d6ed96d89d966bceacd8a2531 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Jul 2014 14:00:46 -0400 Subject: Update changelog --- CHANGES.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index ef456a7e..107aa093 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,13 @@ CHANGES ======= +----- +5.4.1 +----- + +* Python #7776: (ssl_support) Correct usage of host for validation when + tunneling for HTTPS. + --- 5.4 --- -- cgit v1.2.1 From 793bdfffdf388ae3203d4703b4feac3f1f4ccd96 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Jul 2014 14:04:10 -0400 Subject: Bumped to 5.4.1 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index b017944d..f9be4327 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.5" +DEFAULT_VERSION = "5.4.1" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 773d9307..2ac7a45e 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.5' +__version__ = '5.4.1' -- cgit v1.2.1 From 230e26cdb047dfb01ae66a41b076ea494c4ab2eb Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Jul 2014 14:04:12 -0400 Subject: Added tag 5.4.1 for changeset ba3b08c7bffd --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 9204dc6a..79de7ea9 100644 --- a/.hgtags +++ b/.hgtags @@ -147,3 +147,4 @@ e94e768594a1405efde0b79cc60549dd8a4cda9a 3.6 f493e6c4ffd88951871110858c141385305e0077 5.2 1f9505cfd7524ce0c83ab31d139f47b39c56ccbe 5.3 baae103e80c307008b156e426a07eb9f486eb4f0 5.4 +ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 -- cgit v1.2.1 From f420ad2c7d1c0cb232c9713c02fc0f5c798fc682 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Jul 2014 14:04:46 -0400 Subject: Bumped to 5.4.2 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index f9be4327..b2435fed 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.4.1" +DEFAULT_VERSION = "5.4.2" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 2ac7a45e..16cc1382 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.4.1' +__version__ = '5.4.2' -- cgit v1.2.1 From 4cd8b93b95ccac00f3926ffbcead754331853c6d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Jul 2014 08:58:33 -0400 Subject: Use simple asserts. pytest handles this nicely. Removes broken _assertIn. --- setuptools/tests/test_resources.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index 443905cc..279fd139 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -575,13 +575,6 @@ class NamespaceTests(TestCase): pkg_resources._namespace_packages = self._ns_pkgs.copy() sys.path = self._prev_sys_path[:] - def _assertIn(self, member, container): - """ assertIn and assertTrue does not exist in Python2.3""" - if member not in container: - standardMsg = '%s not found in %s' % (safe_repr(member), - safe_repr(container)) - self.fail(self._formatMessage(msg, standardMsg)) - def test_two_levels_deep(self): """ Test nested namespace packages @@ -605,13 +598,13 @@ class NamespaceTests(TestCase): pkg2_init.write(ns_str) pkg2_init.close() import pkg1 - self._assertIn("pkg1", pkg_resources._namespace_packages.keys()) + assert "pkg1" in pkg_resources._namespace_packages try: import pkg1.pkg2 except ImportError: self.fail("Setuptools tried to import the parent namespace package") # check the _namespace_packages dict - self._assertIn("pkg1.pkg2", pkg_resources._namespace_packages.keys()) + assert "pkg1.pkg2" in pkg_resources._namespace_packages self.assertEqual(pkg_resources._namespace_packages["pkg1"], ["pkg1.pkg2"]) # check the __path__ attribute contains both paths self.assertEqual(pkg1.pkg2.__path__, [ -- cgit v1.2.1 From 7003458aa6b13578f8862dca6041ec5c55c21027 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Jul 2014 09:00:52 -0400 Subject: More simple asserts --- setuptools/tests/test_resources.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index 279fd139..1f3b747d 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -605,8 +605,10 @@ class NamespaceTests(TestCase): self.fail("Setuptools tried to import the parent namespace package") # check the _namespace_packages dict assert "pkg1.pkg2" in pkg_resources._namespace_packages - self.assertEqual(pkg_resources._namespace_packages["pkg1"], ["pkg1.pkg2"]) + assert pkg_resources._namespace_packages["pkg1"] == ["pkg1.pkg2"] # check the __path__ attribute contains both paths - self.assertEqual(pkg1.pkg2.__path__, [ + expected = [ os.path.join(self._tmpdir, "site-pkgs", "pkg1", "pkg2"), - os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2")]) + os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2"), + ] + assert pkg1.pkg2.__path__ == expected -- cgit v1.2.1 From a9283f60f7136c12b8ab555bffdeda63e4d4fea5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Jul 2014 09:05:37 -0400 Subject: Bump version pulled for testing ez_setup.py --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 022824f9..44488787 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ python: script: - python setup.py test - python setup.py ptr - - python ez_setup.py --version 3.5.1 + - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From 1237522b992f84cf674833f0745b144874db817c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Jul 2014 09:12:38 -0400 Subject: Disable test_two_levels_deep when /tmp is a symlink. The results it is returning are suitable (shouldn't cause errors in runtime). Users are invited to trace the problem and find a solution. Fixes #231. --- setuptools/tests/test_resources.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index 1f3b747d..759bbcd5 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -16,6 +16,7 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version, from setuptools.command.easy_install import (get_script_header, is_sh, nt_quote_arg) from setuptools.compat import StringIO, iteritems, PY3 +from .py26compat import skipIf try: frozenset @@ -575,6 +576,8 @@ class NamespaceTests(TestCase): pkg_resources._namespace_packages = self._ns_pkgs.copy() sys.path = self._prev_sys_path[:] + msg = "Test fails when /tmp is a symlink. See #231" + @skipIf(os.path.islink(tempfile.gettempdir()), msg) def test_two_levels_deep(self): """ Test nested namespace packages -- cgit v1.2.1 From c6fbf0c0ab840ad86687323c7532ff5b7de6c6bb Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Jul 2014 09:14:36 -0400 Subject: frozenset is available in Python 2.6 --- setuptools/tests/test_resources.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index 759bbcd5..3baa3ab1 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -18,11 +18,6 @@ from setuptools.command.easy_install import (get_script_header, is_sh, from setuptools.compat import StringIO, iteritems, PY3 from .py26compat import skipIf -try: - frozenset -except NameError: - from sets import ImmutableSet as frozenset - def safe_repr(obj, short=False): """ copied from Python2.7""" try: -- cgit v1.2.1 From b73d7fa62dae090d486c54c8cc434e955a06ffb6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 15:19:40 -0400 Subject: Remove unused variable --HG-- extra : rebase_source : c4b515b677e318ffdcd78b2d90ab772e7d1f94e3 --- setuptools/tests/test_sandbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 06b3d434..0e04ad1c 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -19,7 +19,7 @@ def has_win32com(): if not sys.platform.startswith('win32'): return False try: - mod = __import__('win32com') + __import__('win32com') except ImportError: return False return True -- cgit v1.2.1 From ca46f074d12651e32250737c7f380b343b0882ec Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 15:20:32 -0400 Subject: Python 2.3 no longer supported --HG-- extra : rebase_source : debc6141ad369eafeb78b808a15d8558ff3fb83b --- setuptools/tests/test_sandbox.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 0e04ad1c..0f2e693d 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -33,8 +33,6 @@ class TestSandbox(unittest.TestCase): shutil.rmtree(self.dir) def test_devnull(self): - if sys.version < '2.4': - return sandbox = DirectorySandbox(self.dir) sandbox.run(self._file_writer(os.devnull)) -- cgit v1.2.1 From 33f496c61e086bd1ac701e44bc17315c0442010c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 15:29:11 -0400 Subject: Add test capturing failure on Python 2.6. Ref #236 --HG-- extra : rebase_source : 99a2b1e437691f9e1a9982357bc70d91fce91953 --- setuptools.egg-info/entry_points.txt | 2 +- setuptools/tests/test_sandbox.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index de842da8..25a8e1c3 100644 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -1,6 +1,6 @@ [console_scripts] easy_install = setuptools.command.easy_install:main -easy_install-3.4 = setuptools.command.easy_install:main +easy_install-2.6 = setuptools.command.easy_install:main [distutils.commands] alias = setuptools.command.alias:alias diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 0f2e693d..6a890ebc 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -73,5 +73,11 @@ class TestSandbox(unittest.TestCase): setuptools.sandbox._execfile(target, vars(namespace)) assert namespace.result == 'passed' + def test_setup_py_with_CRLF(self): + setup_py = os.path.join(self.dir, 'setup.py') + with open(setup_py, 'wb') as stream: + stream.write(b'"degenerate script"\r\n') + setuptools.sandbox._execfile(setup_py, globals()) + if __name__ == '__main__': unittest.main() -- cgit v1.2.1 From 249e5853496ec108dc78e58c003bf46315b50ffc Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 15:31:47 -0400 Subject: Extract variable --- setuptools/sandbox.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 7985e9ee..a0d3dc61 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -30,7 +30,8 @@ def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ - with open(filename, 'rb') as stream: + mode = 'rb' + with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals -- cgit v1.2.1 From 59e3528c710363e167e0860aab4fd1a611cc058b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 15:36:08 -0400 Subject: Correct execfile implementation for Python 2.6. Fixes #236. --- CHANGES.txt | 6 ++++++ setuptools.egg-info/entry_points.txt | 2 +- setuptools/sandbox.py | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 107aa093..bb5dc66f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,12 @@ CHANGES ======= +----- +5.4.2 +----- + +* Issue #236: Corrected regression in execfile implementation for Python 2.6. + ----- 5.4.1 ----- diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index 25a8e1c3..de842da8 100644 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -1,6 +1,6 @@ [console_scripts] easy_install = setuptools.command.easy_install:main -easy_install-2.6 = setuptools.command.easy_install:main +easy_install-3.4 = setuptools.command.easy_install:main [distutils.commands] alias = setuptools.command.alias:alias diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index a0d3dc61..e79a13a8 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -31,6 +31,10 @@ def _execfile(filename, globals, locals=None): Python 3 implementation of execfile. """ mode = 'rb' + # Python 2.6 compile requires LF for newlines, so use deprecated + # Universal newlines support. + if sys.version_info < (2, 7): + mode += 'U' with open(filename, mode) as stream: script = stream.read() if locals is None: -- cgit v1.2.1 From 8b1cd5ffa7cff7de258e11199fa2ae69ac951c4d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 16:01:36 -0400 Subject: Downgrade pytest to get tests to pass. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 44488787..dc7ed080 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ python: - pypy # command to run tests script: + # work around https://bitbucket.org/hpk42/pytest/issue/555 + - sudo easy_install 'pytest<2.6' - python setup.py test - python setup.py ptr - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From 28ad58b6655b09b9b3e602b2c97eceeb98a7cf9d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 16:05:07 -0400 Subject: Use 'python -m' to install to active Python version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dc7ed080..957064dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: # command to run tests script: # work around https://bitbucket.org/hpk42/pytest/issue/555 - - sudo easy_install 'pytest<2.6' + - sudo python -m easy_install 'pytest<2.6' - python setup.py test - python setup.py ptr - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From 5eac25d201c836281793688282d7659670856d11 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 16:15:35 -0400 Subject: Try running not in the context of the project under test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 957064dc..23a1986a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: # command to run tests script: # work around https://bitbucket.org/hpk42/pytest/issue/555 - - sudo python -m easy_install 'pytest<2.6' + - pushd /tmp; sudo python -m easy_install 'pytest<2.6'; popd - python setup.py test - python setup.py ptr - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From ba9c41335311efe36ac38a061bdceef7633968d1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 16:21:17 -0400 Subject: Omit sudo. Hope pytest is in the virtualenv --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 23a1986a..3077778a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: # command to run tests script: # work around https://bitbucket.org/hpk42/pytest/issue/555 - - pushd /tmp; sudo python -m easy_install 'pytest<2.6'; popd + - pushd /tmp; python -m easy_install 'pytest<2.6'; popd - python setup.py test - python setup.py ptr - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From 1d84ad8fa7e6be6c27d57c3459a5153d55dca4f5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 16:24:02 -0400 Subject: Added tag 5.4.2 for changeset 7adcf1397f6e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 79de7ea9..6b7d38a8 100644 --- a/.hgtags +++ b/.hgtags @@ -148,3 +148,4 @@ f493e6c4ffd88951871110858c141385305e0077 5.2 1f9505cfd7524ce0c83ab31d139f47b39c56ccbe 5.3 baae103e80c307008b156e426a07eb9f486eb4f0 5.4 ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 +7adcf1397f6eccb9e73eda294343de2943f7c8fb 5.4.2 -- cgit v1.2.1 From 0341e4d0b24162ec6a4280c99bafdf8b7bcab324 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 16:24:36 -0400 Subject: Bumped to 5.4.3 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index b2435fed..791973ec 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.4.2" +DEFAULT_VERSION = "5.4.3" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 16cc1382..0e0a34f9 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.4.2' +__version__ = '5.4.3' -- cgit v1.2.1 From 9ce32d32b0b4d62ba844884b436d5a57e5b921cb Mon Sep 17 00:00:00 2001 From: ericholscher Date: Sat, 2 Aug 2014 08:07:57 -0700 Subject: Fix docs to work --- docs/conf.py | 4 ++++ setuptools.egg-info/entry_points.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 9929aaf6..4ab9f41c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,9 @@ # # All configuration values have a default; values that are commented out # serve to show the default. +import sys, os + +sys.path.append(os.path.abspath('..')) import setup as setup_script @@ -195,3 +198,4 @@ latex_documents = [ # If false, no module index is generated. #latex_use_modindex = True + diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index de842da8..528f38e7 100644 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -1,6 +1,6 @@ [console_scripts] easy_install = setuptools.command.easy_install:main -easy_install-3.4 = setuptools.command.easy_install:main +easy_install-2.7 = setuptools.command.easy_install:main [distutils.commands] alias = setuptools.command.alias:alias -- cgit v1.2.1 From 22a27948727dea8a36c9ab663b78c6b24547c0f5 Mon Sep 17 00:00:00 2001 From: ericholscher Date: Sat, 2 Aug 2014 15:35:20 +0000 Subject: entry_points.txt edited online with Bitbucket --- setuptools.egg-info/entry_points.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index 528f38e7..de842da8 100644 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -1,6 +1,6 @@ [console_scripts] easy_install = setuptools.command.easy_install:main -easy_install-2.7 = setuptools.command.easy_install:main +easy_install-3.4 = setuptools.command.easy_install:main [distutils.commands] alias = setuptools.command.alias:alias -- cgit v1.2.1 From 702a87a0a2ab03c376fea01903075c8fed45a8fb Mon Sep 17 00:00:00 2001 From: ericholscher Date: Sat, 2 Aug 2014 15:35:33 +0000 Subject: conf.py edited online with Bitbucket --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 4ab9f41c..faf3a915 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -198,4 +198,3 @@ latex_documents = [ # If false, no module index is generated. #latex_use_modindex = True - -- cgit v1.2.1 From 1194bad8b3d424469364ef497c3202dfb4ebcf62 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 4 Aug 2014 10:41:58 -0400 Subject: Correct syntax in gui_scripts. Fixes #238. --- docs/setuptools.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/setuptools.txt b/docs/setuptools.txt index 86e23ff9..c3844cf2 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -479,7 +479,7 @@ script called ``baz``, you might do something like this:: 'bar = other_module:some_func', ], 'gui_scripts': [ - 'baz = my_package_gui.start_func', + 'baz = my_package_gui:start_func', ] } ) -- cgit v1.2.1 From 0ce646ec0138c76d9cf7a1a25103a865a54f18fa Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 7 Aug 2014 08:03:49 -0400 Subject: Testing fix for pytest-555 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3077778a..18334df4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ python: - pypy # command to run tests script: - # work around https://bitbucket.org/hpk42/pytest/issue/555 - - pushd /tmp; python -m easy_install 'pytest<2.6'; popd + # testing fix for https://bitbucket.org/hpk42/pytest/issue/555 + - pip install --pre -i https://devpi.net/hpk/dev/ pytest - python setup.py test - python setup.py ptr - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From f18617330c7c34684c7cd8e7d2fbb9873e12e874 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 7 Aug 2014 08:13:15 -0400 Subject: Indicate upgrade to test pytest-555 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 18334df4..bc387f46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: # command to run tests script: # testing fix for https://bitbucket.org/hpk42/pytest/issue/555 - - pip install --pre -i https://devpi.net/hpk/dev/ pytest + - pip install --pre -i https://devpi.net/hpk/dev/ --upgrade pytest - python setup.py test - python setup.py ptr - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From ac14ffe92376c54bb2d5a443e5177d85faeda75d Mon Sep 17 00:00:00 2001 From: Benedikt Morbach Date: Thu, 7 Aug 2014 17:57:00 +0200 Subject: make order of lines in top_level.txt deterministic like it was done for requirements and entry_points --- setuptools/command/egg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 72493d0b..1ef723da 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -389,7 +389,7 @@ def write_toplevel_names(cmd, basename, filename): for k in cmd.distribution.iter_distribution_names() ] ) - cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n') + cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs) + '\n') def overwrite_arg(cmd, basename, filename): -- cgit v1.2.1 From 50cd15aef3a657ee9cf86326e18e3bc2919b4cf6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 14:06:15 -0400 Subject: Include setup_requires directive in Distribution attributes and metadata. Fixes #239. --- CHANGES.txt | 8 ++++++++ setup.py | 1 + setuptools/dist.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index bb5dc66f..71165b19 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,14 @@ CHANGES ======= +--- +5.5 +--- + +* Issue #239: Setuptools now includes the setup_requires directive on + Distribution objects and validates the syntax just like install_requires + and tests_require directives. + ----- 5.4.2 ----- diff --git a/setup.py b/setup.py index f7be0567..52d16ff3 100755 --- a/setup.py +++ b/setup.py @@ -144,6 +144,7 @@ setup_params = dict( "extras_require = setuptools.dist:check_extras", "install_requires = setuptools.dist:check_requirements", "tests_require = setuptools.dist:check_requirements", + "setup_reqires = setuptools.dist:check_requirements", "entry_points = setuptools.dist:check_entry_points", "test_suite = setuptools.dist:check_test_suite", "zip_safe = setuptools.dist:assert_bool", diff --git a/setuptools/dist.py b/setuptools/dist.py index dac4dfa8..8b36f67c 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -259,7 +259,7 @@ class Distribution(_Distribution): self.dependency_links = attrs.pop('dependency_links', []) assert_string_list(self,'dependency_links',self.dependency_links) if attrs and 'setup_requires' in attrs: - self.fetch_build_eggs(attrs.pop('setup_requires')) + self.fetch_build_eggs(attrs['setup_requires']) for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): if not hasattr(self,ep.name): setattr(self,ep.name,None) -- cgit v1.2.1 From 1531c8041c6b3f4e077d6edeb8305db2aacdbfb7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 14:45:59 -0400 Subject: Correct documentation --- ez_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ez_setup.py b/ez_setup.py index 791973ec..96ec11d5 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -268,7 +268,7 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, Download setuptools from a specified location and return its filename `version` should be a valid setuptools version number that is available - as an egg for download under the `download_base` URL (which should end + as an sdist for download under the `download_base` URL (which should end with a '/'). `to_dir` is the directory where the egg will be downloaded. `delay` is the number of seconds to pause before an actual download attempt. -- cgit v1.2.1 From 28097c4d3dad73f7813a5e271ab3ad9dc6302b99 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 14:49:28 -0400 Subject: Bumped to 5.5 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 96ec11d5..3f98bd07 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.4.3" +DEFAULT_VERSION = "5.5" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 0e0a34f9..773d9307 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.4.3' +__version__ = '5.5' -- cgit v1.2.1 From 19a627c768b7c0a155beea2fce0bb0f4c98c3959 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 14:49:30 -0400 Subject: Added tag 5.5 for changeset 68910a89f97a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 6b7d38a8..74f7f16d 100644 --- a/.hgtags +++ b/.hgtags @@ -149,3 +149,4 @@ f493e6c4ffd88951871110858c141385305e0077 5.2 baae103e80c307008b156e426a07eb9f486eb4f0 5.4 ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 7adcf1397f6eccb9e73eda294343de2943f7c8fb 5.4.2 +68910a89f97a508a64f9f235dc64ad43d4477ea0 5.5 -- cgit v1.2.1 From f4ff967301bdd5f33631d2650baad9776baa4c10 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 14:50:14 -0400 Subject: Bumped to 5.6 in preparation for next release. --- ez_setup.py | 2 +- setuptools.egg-info/entry_points.txt | 1 + setuptools/version.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 3f98bd07..4b9eee61 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.5" +DEFAULT_VERSION = "5.6" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index de842da8..df4ac2ae 100644 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -36,6 +36,7 @@ install_requires = setuptools.dist:check_requirements namespace_packages = setuptools.dist:check_nsp package_data = setuptools.dist:check_package_data packages = setuptools.dist:check_packages +setup_reqires = setuptools.dist:check_requirements test_loader = setuptools.dist:check_importable test_runner = setuptools.dist:check_importable test_suite = setuptools.dist:check_test_suite diff --git a/setuptools/version.py b/setuptools/version.py index 773d9307..49e04a62 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.5' +__version__ = '5.6' -- cgit v1.2.1 From b95f4114a81284d6c286eadd799032277c38f6f9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 19:50:55 -0400 Subject: Fix typo; ref #239. --- CHANGES.txt | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 71165b19..54284c88 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,12 @@ CHANGES ======= +----- +5.5.1 +----- + +* Issue #239: Fix typo in 5.5 such that fix did not take. + --- 5.5 --- diff --git a/setup.py b/setup.py index 52d16ff3..bac4e29d 100755 --- a/setup.py +++ b/setup.py @@ -144,7 +144,7 @@ setup_params = dict( "extras_require = setuptools.dist:check_extras", "install_requires = setuptools.dist:check_requirements", "tests_require = setuptools.dist:check_requirements", - "setup_reqires = setuptools.dist:check_requirements", + "setup_requires = setuptools.dist:check_requirements", "entry_points = setuptools.dist:check_entry_points", "test_suite = setuptools.dist:check_test_suite", "zip_safe = setuptools.dist:assert_bool", -- cgit v1.2.1 From 26cc02d02a295ff30c6a0f0b661bfc6f2fd2246b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 19:55:29 -0400 Subject: Bumped to 5.5.1 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 4b9eee61..6de57c04 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.6" +DEFAULT_VERSION = "5.5.1" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 49e04a62..45e4cae4 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.6' +__version__ = '5.5.1' -- cgit v1.2.1 From 09987b9fd84bf2cda4fea81bd4a8d500cb553281 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 19:55:32 -0400 Subject: Added tag 5.5.1 for changeset 949a66af4f03 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 74f7f16d..6fb941db 100644 --- a/.hgtags +++ b/.hgtags @@ -150,3 +150,4 @@ baae103e80c307008b156e426a07eb9f486eb4f0 5.4 ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 7adcf1397f6eccb9e73eda294343de2943f7c8fb 5.4.2 68910a89f97a508a64f9f235dc64ad43d4477ea0 5.5 +949a66af4f03521e1404deda940aa951418a13d2 5.5.1 -- cgit v1.2.1 From 064554652d35bfd14eb4787a808d4d27d4f643a1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 10 Aug 2014 19:56:16 -0400 Subject: Bumped to 5.5.2 in preparation for next release. --- ez_setup.py | 2 +- setuptools.egg-info/entry_points.txt | 2 +- setuptools/version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 6de57c04..cf3621ca 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.5.1" +DEFAULT_VERSION = "5.5.2" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index df4ac2ae..72a5ffe0 100644 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -36,7 +36,7 @@ install_requires = setuptools.dist:check_requirements namespace_packages = setuptools.dist:check_nsp package_data = setuptools.dist:check_package_data packages = setuptools.dist:check_packages -setup_reqires = setuptools.dist:check_requirements +setup_requires = setuptools.dist:check_requirements test_loader = setuptools.dist:check_importable test_runner = setuptools.dist:check_importable test_suite = setuptools.dist:check_test_suite diff --git a/setuptools/version.py b/setuptools/version.py index 45e4cae4..e441e915 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.5.1' +__version__ = '5.5.2' -- cgit v1.2.1 From dd832d63bdc2c18a5456f41a1d099e59becd0bcb Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 14 Aug 2014 12:52:47 -0400 Subject: Use absolute_import in svn_utils. Fixes #242. --- CHANGES.txt | 7 +++++++ setuptools/svn_utils.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 54284c88..3674383c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,13 @@ CHANGES ======= +--- +5.6 +--- + +* Issue #242: Use absolute imports in svn_utils to avoid issues if the + installing package adds an xml module to the path. + ----- 5.5.1 ----- diff --git a/setuptools/svn_utils.py b/setuptools/svn_utils.py index 2dcfd899..dadb682a 100644 --- a/setuptools/svn_utils.py +++ b/setuptools/svn_utils.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + import os import re import sys -- cgit v1.2.1 From 0a9f4f05fd110d6676de8cd58506499a1ac00aad Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 14 Aug 2014 12:57:25 -0400 Subject: Bumped to 5.6 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index cf3621ca..4b9eee61 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.5.2" +DEFAULT_VERSION = "5.6" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index e441e915..49e04a62 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.5.2' +__version__ = '5.6' -- cgit v1.2.1 From 912029443187711fcf3c0b7bf841dba4a6cb8d74 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 14 Aug 2014 12:57:27 -0400 Subject: Added tag 5.6 for changeset a1fc0220bfa3 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 6fb941db..93337a77 100644 --- a/.hgtags +++ b/.hgtags @@ -151,3 +151,4 @@ ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 7adcf1397f6eccb9e73eda294343de2943f7c8fb 5.4.2 68910a89f97a508a64f9f235dc64ad43d4477ea0 5.5 949a66af4f03521e1404deda940aa951418a13d2 5.5.1 +a1fc0220bfa3581158688789f6dfdc00672eb99b 5.6 -- cgit v1.2.1 From 06c0f3f41296ab29b626b3c7970f7bfa9e159439 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 14 Aug 2014 12:58:05 -0400 Subject: Bumped to 5.7 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 4b9eee61..a34fa806 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.6" +DEFAULT_VERSION = "5.7" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 49e04a62..8666d542 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.6' +__version__ = '5.7' -- cgit v1.2.1 From 5cbc6c70851acaa617a581c977aa0a55e2391ef7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 15 Aug 2014 09:50:33 -0400 Subject: Use MemoizedZipManifests for all operations. Fixes #240. --- CHANGES.txt | 11 +++++++++++ pkg_resources.py | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 3674383c..83b05bbe 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,17 @@ CHANGES ======= +--- +5.7 +--- + +* Issue #240: Based on real-world performance measures against 5.4, zip + manifests are now cached in all circumstances. The + ``PKG_RESOURCES_CACHE_ZIP_MANIFESTS`` environment variable is no longer + relevant. The observed "memory increase" referenced in the 5.4 release + notes and detailed in Issue #154 was likely not an increase over the status + quo, but rather only an increase over not storing the zip info at all. + --- 5.6 --- diff --git a/pkg_resources.py b/pkg_resources.py index 11debf65..ee2c553b 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -1605,11 +1605,7 @@ class ZipProvider(EggProvider): """Resource support for zips and eggs""" eagers = None - _zip_manifests = ( - MemoizedZipManifests() - if os.environ.get('PKG_RESOURCES_CACHE_ZIP_MANIFESTS') else - ZipManifests() - ) + _zip_manifests = MemoizedZipManifests() def __init__(self, module): EggProvider.__init__(self, module) -- cgit v1.2.1 From 75f8f35ca991efcfdfcd4800e8e2f8241b9b1162 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 15 Aug 2014 09:54:35 -0400 Subject: Added tag 5.7 for changeset 37ed55fd310d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 93337a77..1f1cac00 100644 --- a/.hgtags +++ b/.hgtags @@ -152,3 +152,4 @@ ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 68910a89f97a508a64f9f235dc64ad43d4477ea0 5.5 949a66af4f03521e1404deda940aa951418a13d2 5.5.1 a1fc0220bfa3581158688789f6dfdc00672eb99b 5.6 +37ed55fd310d0cd32009dc5676121e86b404a23d 5.7 -- cgit v1.2.1 From 6c42630380e93d2945620bae9a351a506bf42b19 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 15 Aug 2014 09:55:11 -0400 Subject: Bumped to 5.8 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index a34fa806..74c8224a 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.7" +DEFAULT_VERSION = "5.8" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 8666d542..868f2d33 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.7' +__version__ = '5.8' -- cgit v1.2.1 From 9fe6b474304a5a679b00d6218f9d9471a2c8a2fd Mon Sep 17 00:00:00 2001 From: ericholscher Date: Sat, 16 Aug 2014 15:52:49 +0000 Subject: Add comment to explain code. --- docs/conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index faf3a915..203dc93d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,9 +12,10 @@ # autogenerated file. # # All configuration values have a default; values that are commented out -# serve to show the default. -import sys, os +# serve to show the default +# Allow Sphinx to find the setup command that is imported below. +import sys, os sys.path.append(os.path.abspath('..')) import setup as setup_script -- cgit v1.2.1 From 5804094016f1b5188c14d1c69fdae7c55f1f242d Mon Sep 17 00:00:00 2001 From: ericholscher Date: Sun, 17 Aug 2014 05:52:57 +0000 Subject: Update conf.py to place it below original docstring. --- docs/conf.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 203dc93d..8be5c3dd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,17 +14,16 @@ # All configuration values have a default; values that are commented out # serve to show the default -# Allow Sphinx to find the setup command that is imported below. +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. + +# Allow Sphinx to find the setup command that is imported below, as referenced above. import sys, os sys.path.append(os.path.abspath('..')) import setup as setup_script -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.append(os.path.abspath('.')) - # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions -- cgit v1.2.1 From 7702536f882a3e03cea35bb3066069793351f1ce Mon Sep 17 00:00:00 2001 From: Hugues Lerebours Date: Mon, 18 Aug 2014 14:11:34 +0200 Subject: [Fix/Typo] Fix missing parenthesis in egg_info.py Syntax error introduced in be37eff86c761a399c1ec98b0e5eeed9a90c9cd7 --- setuptools/command/egg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 1ef723da..06764a17 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -389,7 +389,7 @@ def write_toplevel_names(cmd, basename, filename): for k in cmd.distribution.iter_distribution_names() ] ) - cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs) + '\n') + cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs)) + '\n') def overwrite_arg(cmd, basename, filename): -- cgit v1.2.1 From 0ea11fb8f355f41f4290dd2ffd638a8b3c21baea Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 21 Aug 2014 09:24:33 -0400 Subject: Updated documentation to reflect support for PowerShell 3 on earlier versions of Windows. Fixes #247. --- README.txt | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/README.txt b/README.txt index ad6386e5..9a142bf7 100755 --- a/README.txt +++ b/README.txt @@ -23,13 +23,14 @@ latest known stable release. .. _ez_setup.py: https://bootstrap.pypa.io/ez_setup.py -Windows 8 (Powershell) -====================== +Windows (Powershell 3 or later) +=============================== For best results, uninstall previous versions FIRST (see `Uninstalling`_). -Using Windows 8 or later, it's possible to install with one simple Powershell -command. Start up Powershell and paste this command:: +Using Windows 8 (which includes PowerShell 3) or earlier versions of Windows +with PowerShell 3 installed, it's possible to install with one simple +Powershell command. Start up Powershell and paste this command:: > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python - @@ -45,8 +46,8 @@ Python 2.7 installed:: > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | py -3 - The recommended way to install setuptools on Windows is to download -`ez_setup.py`_ and run it. The script will download the appropriate .egg -file and install it for you. +`ez_setup.py`_ and run it. The script will download the appropriate +distribution file and install it for you. Once installation is complete, you will find an ``easy_install`` program in your Python ``Scripts`` subdirectory. For simple invocation and best results, @@ -55,11 +56,12 @@ present. If you did a user-local install, the ``Scripts`` subdirectory is ``$env:APPDATA\Python\Scripts``. -Windows 7 (or graphical install) -================================ +Windows (simplified) +==================== -For Windows 7 and earlier, download `ez_setup.py`_ using your favorite web -browser or other technique and "run" that file. +For Windows without PowerShell 3 or for installation without a command-line, +download `ez_setup.py`_ using your preferred web browser or other technique +and "run" that file. Unix (wget) -- cgit v1.2.1 From f8844d7508fd6fe81b161b14320b2dcd8ec88315 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 21 Aug 2014 09:48:06 -0400 Subject: Backed out changeset: be37eff86c76 Syntax was invalid. --- setuptools/command/egg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 1ef723da..72493d0b 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -389,7 +389,7 @@ def write_toplevel_names(cmd, basename, filename): for k in cmd.distribution.iter_distribution_names() ] ) - cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs) + '\n') + cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n') def overwrite_arg(cmd, basename, filename): -- cgit v1.2.1 From 5725c38fc0280287b770ed7869c3c5258441f4fd Mon Sep 17 00:00:00 2001 From: Benedikt Morbach Date: Thu, 7 Aug 2014 17:57:00 +0200 Subject: make order of lines in top_level.txt deterministic without this, every build produces a different result, as the lines are ordered randomly. This makes builds reproducible. If you build a package two times, you get the same result, as you would expect. Basically the same thing was already done for requirements and entry_points.txt It is useful e.g. if you want to rebuild a package that you downloaded, to ensure that no-one tampered with it, or even if you just want to examine the differences between two builds/versions of one package. --- setuptools/command/egg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 72493d0b..06764a17 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -389,7 +389,7 @@ def write_toplevel_names(cmd, basename, filename): for k in cmd.distribution.iter_distribution_names() ] ) - cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n') + cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs)) + '\n') def overwrite_arg(cmd, basename, filename): -- cgit v1.2.1 From 63ddca7cd1011b8d4b1348315c02fe9fd6a404e2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 09:54:15 -0400 Subject: Normalize syntax --- setuptools/command/install_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 7692e0f3..c0c271a4 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -17,7 +17,7 @@ class install_lib(orig.install_lib): svem = (nsp and self.get_finalized_command('install') .single_version_externally_managed) exclude_names = ['__init__.py', '__init__.pyc', '__init__.pyo'] - if hasattr(imp, 'get_tag') : + if hasattr(imp, 'get_tag'): exclude_names.extend(( os.path.join( '__pycache__', @@ -33,7 +33,7 @@ class install_lib(orig.install_lib): parts = pkg.split('.') while parts: pkgdir = os.path.join(self.install_dir, *parts) - for f in exclude_names : + for f in exclude_names: exclude[os.path.join(pkgdir, f)] = 1 parts.pop() return exclude -- cgit v1.2.1 From a7dbe706890eab7ba330c51ea59349c28080dfde Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:02:01 -0400 Subject: Extract method for generating exclude names --- setuptools/command/install_lib.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index c0c271a4..259f0899 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -16,6 +16,22 @@ class install_lib(orig.install_lib): nsp = self.distribution.namespace_packages svem = (nsp and self.get_finalized_command('install') .single_version_externally_managed) + if svem: + for pkg in nsp: + parts = pkg.split('.') + while parts: + pkgdir = os.path.join(self.install_dir, *parts) + for f in self._gen_exclude_names(): + exclude[os.path.join(pkgdir, f)] = 1 + parts.pop() + return exclude + + @staticmethod + def _gen_exclude_names(): + """ + Generate the list of file paths to be excluded for namespace + packages (bytecode cache files). + """ exclude_names = ['__init__.py', '__init__.pyc', '__init__.pyo'] if hasattr(imp, 'get_tag'): exclude_names.extend(( @@ -28,15 +44,7 @@ class install_lib(orig.install_lib): '__init__.' + imp.get_tag() + '.pyo' ), )) - if svem: - for pkg in nsp: - parts = pkg.split('.') - while parts: - pkgdir = os.path.join(self.install_dir, *parts) - for f in exclude_names: - exclude[os.path.join(pkgdir, f)] = 1 - parts.pop() - return exclude + return exclude_names def copy_tree( self, infile, outfile, -- cgit v1.2.1 From 4e5bbb8e5175b35f8cbaace630bd0dd3091d6946 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:05:18 -0400 Subject: Generate the filenames more directly. --- setuptools/command/install_lib.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 259f0899..3f39d945 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -29,22 +29,18 @@ class install_lib(orig.install_lib): @staticmethod def _gen_exclude_names(): """ - Generate the list of file paths to be excluded for namespace - packages (bytecode cache files). + Generate file paths to be excluded for namespace packages (bytecode + cache files). """ - exclude_names = ['__init__.py', '__init__.pyc', '__init__.pyo'] - if hasattr(imp, 'get_tag'): - exclude_names.extend(( - os.path.join( - '__pycache__', - '__init__.' + imp.get_tag() + '.pyc' - ), - os.path.join( - '__pycache__', - '__init__.' + imp.get_tag() + '.pyo' - ), - )) - return exclude_names + yield '__init__.py' + yield '__init__.pyc' + yield '__init__.pyo' + + if not hasattr(imp, 'get_tag'): + return + + yield os.path.join('__pycache__', '__init__.' + imp.get_tag() + '.pyc') + yield os.path.join('__pycache__', '__init__.' + imp.get_tag() + '.pyo') def copy_tree( self, infile, outfile, -- cgit v1.2.1 From f6f409ac7dc06be2524211a717182cd96b21e13f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:06:35 -0400 Subject: Extract calculation of base path --- setuptools/command/install_lib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 3f39d945..d1c91b7b 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -39,8 +39,9 @@ class install_lib(orig.install_lib): if not hasattr(imp, 'get_tag'): return - yield os.path.join('__pycache__', '__init__.' + imp.get_tag() + '.pyc') - yield os.path.join('__pycache__', '__init__.' + imp.get_tag() + '.pyo') + base = os.path.join('__pycache__', '__init__.' + imp.get_tag()) + yield base + '.pyc' + yield base + '.pyo' def copy_tree( self, infile, outfile, -- cgit v1.2.1 From 23f5f548a9dfffe5c04f40eee461d2270ecf5f53 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:07:07 -0400 Subject: Add comment --- setuptools/command/install_lib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index d1c91b7b..a1cbd2aa 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -32,7 +32,9 @@ class install_lib(orig.install_lib): Generate file paths to be excluded for namespace packages (bytecode cache files). """ + # always exclude the package module itself yield '__init__.py' + yield '__init__.pyc' yield '__init__.pyo' -- cgit v1.2.1 From 03fe70a1793ea5dae7685323f1146eb12c2a0e0e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:08:48 -0400 Subject: Construct exclusions as a set --- setuptools/command/install_lib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index a1cbd2aa..f4b295cc 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -12,7 +12,7 @@ class install_lib(orig.install_lib): self.byte_compile(outfiles) def get_exclusions(self): - exclude = {} + exclude = set() nsp = self.distribution.namespace_packages svem = (nsp and self.get_finalized_command('install') .single_version_externally_managed) @@ -22,9 +22,9 @@ class install_lib(orig.install_lib): while parts: pkgdir = os.path.join(self.install_dir, *parts) for f in self._gen_exclude_names(): - exclude[os.path.join(pkgdir, f)] = 1 + exclude.add(os.path.join(pkgdir, f)) parts.pop() - return exclude + return dict.fromkeys(exclude, 1) @staticmethod def _gen_exclude_names(): -- cgit v1.2.1 From e8914480487426305fece22422fdb725f88add7f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:19:36 -0400 Subject: Add docstring for get_exclusions. Just return the set as it is a sized container. --- setuptools/command/install_lib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index f4b295cc..91d2b25d 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -12,6 +12,10 @@ class install_lib(orig.install_lib): self.byte_compile(outfiles) def get_exclusions(self): + """ + Return a collections.Sized collections.Container of paths to be + excluded for single_version_externally_managed installations. + """ exclude = set() nsp = self.distribution.namespace_packages svem = (nsp and self.get_finalized_command('install') @@ -24,7 +28,7 @@ class install_lib(orig.install_lib): for f in self._gen_exclude_names(): exclude.add(os.path.join(pkgdir, f)) parts.pop() - return dict.fromkeys(exclude, 1) + return exclude @staticmethod def _gen_exclude_names(): -- cgit v1.2.1 From bd62121950280590c9388db065df389cf2d8280d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:29:38 -0400 Subject: Extract method for calculating namespace packages for single_version_externally_managed --- setuptools/command/install_lib.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 91d2b25d..bf587a04 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -17,19 +17,31 @@ class install_lib(orig.install_lib): excluded for single_version_externally_managed installations. """ exclude = set() - nsp = self.distribution.namespace_packages - svem = (nsp and self.get_finalized_command('install') - .single_version_externally_managed) - if svem: - for pkg in nsp: - parts = pkg.split('.') - while parts: - pkgdir = os.path.join(self.install_dir, *parts) - for f in self._gen_exclude_names(): - exclude.add(os.path.join(pkgdir, f)) - parts.pop() + for pkg in self._get_SVEM_NSPs(): + parts = pkg.split('.') + while parts: + pkgdir = os.path.join(self.install_dir, *parts) + for f in self._gen_exclude_names(): + exclude.add(os.path.join(pkgdir, f)) + parts.pop() return exclude + def _get_SVEM_NSPs(self): + """ + Get namespace packages (list) but only for + single_version_externally_managed installations and empty otherwise. + """ + # TODO: is it necessary to short-circuit here? i.e. what's the cost + # if get_finalized_command is called even when namespace_packages is + # False? + if not self.distribution.namespace_packages: + return [] + + install_cmd = self.get_finalized_command('install') + svem = install_cmd.single_version_externally_managed + + return self.distribution.namespace_packages if svem else [] + @staticmethod def _gen_exclude_names(): """ -- cgit v1.2.1 From 82c2101634a423ae9ccf003612b89fbd230f8303 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:39:53 -0400 Subject: Extract method for computing parent packages of a package --- setuptools/command/install_lib.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index bf587a04..88b35972 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -17,15 +17,24 @@ class install_lib(orig.install_lib): excluded for single_version_externally_managed installations. """ exclude = set() - for pkg in self._get_SVEM_NSPs(): - parts = pkg.split('.') - while parts: + for ns_pkg in self._get_SVEM_NSPs(): + for pkg in self._all_packages(ns_pkg): + parts = pkg.split('.') pkgdir = os.path.join(self.install_dir, *parts) for f in self._gen_exclude_names(): exclude.add(os.path.join(pkgdir, f)) - parts.pop() return exclude + @staticmethod + def _all_packages(pkg_name): + """ + >>> list(install_lib._all_packages('foo.bar.baz')) + ['foo.bar.baz', 'foo.bar', 'foo'] + """ + while pkg_name: + yield pkg_name + pkg_name, sep, child = pkg_name.partition('.') + def _get_SVEM_NSPs(self): """ Get namespace packages (list) but only for -- cgit v1.2.1 From 10e504abc7f0a0c45157bf4d6cbbd63dea6a67dd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:41:49 -0400 Subject: Extract path calculation for paths --- setuptools/command/install_lib.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 88b35972..92490b6e 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -17,12 +17,11 @@ class install_lib(orig.install_lib): excluded for single_version_externally_managed installations. """ exclude = set() + pkg_path = lambda pkg: os.path.join(self.install_dir, *pkg.split('.')) for ns_pkg in self._get_SVEM_NSPs(): for pkg in self._all_packages(ns_pkg): - parts = pkg.split('.') - pkgdir = os.path.join(self.install_dir, *parts) for f in self._gen_exclude_names(): - exclude.add(os.path.join(pkgdir, f)) + exclude.add(os.path.join(pkg_path(pkg), f)) return exclude @staticmethod -- cgit v1.2.1 From b43f75980dd674153cafec047709092438d54b5c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:43:35 -0400 Subject: Rewrite package traversal as a generator expression --- setuptools/command/install_lib.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 92490b6e..7f157a0f 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -18,8 +18,12 @@ class install_lib(orig.install_lib): """ exclude = set() pkg_path = lambda pkg: os.path.join(self.install_dir, *pkg.split('.')) - for ns_pkg in self._get_SVEM_NSPs(): - for pkg in self._all_packages(ns_pkg): + all_packages = ( + pkg + for ns_pkg in self._get_SVEM_NSPs() + for pkg in self._all_packages(ns_pkg) + ) + for pkg in all_packages: for f in self._gen_exclude_names(): exclude.add(os.path.join(pkg_path(pkg), f)) return exclude -- cgit v1.2.1 From c6340e42c8a06a35048659d7178efb329cda3249 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:43:43 -0400 Subject: Reindent --- setuptools/command/install_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 7f157a0f..371a9e72 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -24,8 +24,8 @@ class install_lib(orig.install_lib): for pkg in self._all_packages(ns_pkg) ) for pkg in all_packages: - for f in self._gen_exclude_names(): - exclude.add(os.path.join(pkg_path(pkg), f)) + for f in self._gen_exclude_names(): + exclude.add(os.path.join(pkg_path(pkg), f)) return exclude @staticmethod -- cgit v1.2.1 From b908527864443899b89cf568ac9397aef7ad16c9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:46:14 -0400 Subject: Use itertools.product for a cross-product of two iterables --- setuptools/command/install_lib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 371a9e72..c2730568 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -1,5 +1,6 @@ import distutils.command.install_lib as orig import os, imp +from itertools import product class install_lib(orig.install_lib): """Don't add compiled flags to filenames of non-Python files""" @@ -23,9 +24,8 @@ class install_lib(orig.install_lib): for ns_pkg in self._get_SVEM_NSPs() for pkg in self._all_packages(ns_pkg) ) - for pkg in all_packages: - for f in self._gen_exclude_names(): - exclude.add(os.path.join(pkg_path(pkg), f)) + for pkg, f in product(all_packages, self._gen_exclude_names()): + exclude.add(os.path.join(pkg_path(pkg), f)) return exclude @staticmethod -- cgit v1.2.1 From 38b6f23637bcf8db5b9237393399041fbe36c65f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:46:37 -0400 Subject: Reorganize imports --- setuptools/command/install_lib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index c2730568..cc531c01 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -1,6 +1,7 @@ -import distutils.command.install_lib as orig -import os, imp +import os +import imp from itertools import product +import distutils.command.install_lib as orig class install_lib(orig.install_lib): """Don't add compiled flags to filenames of non-Python files""" -- cgit v1.2.1 From b925f19a4ef1b214650b770c74a083fc4f982758 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:52:20 -0400 Subject: Incorporate the exclusion path in the _exclude function. --- setuptools/command/install_lib.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index cc531c01..f36d8651 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -19,14 +19,18 @@ class install_lib(orig.install_lib): excluded for single_version_externally_managed installations. """ exclude = set() - pkg_path = lambda pkg: os.path.join(self.install_dir, *pkg.split('.')) + + def _exclude(pkg, exclusion_path): + parts = pkg.split('.') + [exclusion_path] + return os.path.join(self.install_dir, *parts) + all_packages = ( pkg for ns_pkg in self._get_SVEM_NSPs() for pkg in self._all_packages(ns_pkg) ) for pkg, f in product(all_packages, self._gen_exclude_names()): - exclude.add(os.path.join(pkg_path(pkg), f)) + exclude.add(_exclude(pkg, f)) return exclude @staticmethod -- cgit v1.2.1 From 86f35df37c309d2192a95259e77c6b4ba7f73876 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:56:24 -0400 Subject: Return the exclusions directly --- setuptools/command/install_lib.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index f36d8651..dcd85dec 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -1,6 +1,6 @@ import os import imp -from itertools import product +from itertools import product, starmap import distutils.command.install_lib as orig class install_lib(orig.install_lib): @@ -18,9 +18,11 @@ class install_lib(orig.install_lib): Return a collections.Sized collections.Container of paths to be excluded for single_version_externally_managed installations. """ - exclude = set() - def _exclude(pkg, exclusion_path): + """ + Given a package name and exclusion path within that package, + compute the full exclusion path. + """ parts = pkg.split('.') + [exclusion_path] return os.path.join(self.install_dir, *parts) @@ -29,9 +31,9 @@ class install_lib(orig.install_lib): for ns_pkg in self._get_SVEM_NSPs() for pkg in self._all_packages(ns_pkg) ) - for pkg, f in product(all_packages, self._gen_exclude_names()): - exclude.add(_exclude(pkg, f)) - return exclude + + excl_specs = product(all_packages, self._gen_exclude_names()) + return set(starmap(_exclude, excl_specs)) @staticmethod def _all_packages(pkg_name): -- cgit v1.2.1 From e301ab4639508fd7d9d4a3beb51974d211d1c109 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 10:59:09 -0400 Subject: Move inline function into an instance method and rename for clarity. --- setuptools/command/install_lib.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index dcd85dec..3cd16a8f 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -18,22 +18,22 @@ class install_lib(orig.install_lib): Return a collections.Sized collections.Container of paths to be excluded for single_version_externally_managed installations. """ - def _exclude(pkg, exclusion_path): - """ - Given a package name and exclusion path within that package, - compute the full exclusion path. - """ - parts = pkg.split('.') + [exclusion_path] - return os.path.join(self.install_dir, *parts) - all_packages = ( pkg for ns_pkg in self._get_SVEM_NSPs() for pkg in self._all_packages(ns_pkg) ) - excl_specs = product(all_packages, self._gen_exclude_names()) - return set(starmap(_exclude, excl_specs)) + excl_specs = product(all_packages, self._gen_exclusion_paths()) + return set(starmap(self._exclude_pkg_path, excl_specs)) + + def _exclude_pkg_path(self, pkg, exclusion_path): + """ + Given a package name and exclusion path within that package, + compute the full exclusion path. + """ + parts = pkg.split('.') + [exclusion_path] + return os.path.join(self.install_dir, *parts) @staticmethod def _all_packages(pkg_name): @@ -62,7 +62,7 @@ class install_lib(orig.install_lib): return self.distribution.namespace_packages if svem else [] @staticmethod - def _gen_exclude_names(): + def _gen_exclusion_paths(): """ Generate file paths to be excluded for namespace packages (bytecode cache files). -- cgit v1.2.1 From 13250db6b6ac59befa6e855f67958457f3dcf8c6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 11:09:32 -0400 Subject: Update changelog --- CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index a6e27372..4fae469b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -23,6 +23,8 @@ CHANGES Any users producing distributions with filenames that match those above case-insensitively, but not case-sensitively, should rename those files in their repository for better portability. +* Pull Request #72: When using ``single_version_externally_managed``, the + exclusion list now includes Python 3.2 ``__pycache__`` entries. --- 5.8 -- cgit v1.2.1 From 74a125575d6983979b244c07c36473b4bc79ac38 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 11:12:15 -0400 Subject: Update changelog --- CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 4fae469b..4b20333d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -25,6 +25,8 @@ CHANGES their repository for better portability. * Pull Request #72: When using ``single_version_externally_managed``, the exclusion list now includes Python 3.2 ``__pycache__`` entries. +* Pull Request #76 and Pull Request #78: lines in top_level.txt are now + ordered deterministically. --- 5.8 -- cgit v1.2.1 From b54668a95934f1f63647e219cbbcbeab4a524ac3 Mon Sep 17 00:00:00 2001 From: Jesse Weinstein Date: Thu, 28 Aug 2014 20:55:27 +0000 Subject: Fix issue #118: Prevent the egg-info directory from being redundantly included in the list of modified files. --HG-- extra : rebase_source : 8bad8bf37ef1fdc59b4c1ba21fcff43d25f9b2be --- setuptools/command/install_egg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py index fd0f118b..992709f1 100755 --- a/setuptools/command/install_egg_info.py +++ b/setuptools/command/install_egg_info.py @@ -27,7 +27,7 @@ class install_egg_info(Command): ).egg_name() + '.egg-info' self.source = ei_cmd.egg_info self.target = os.path.join(self.install_dir, basename) - self.outputs = [self.target] + self.outputs = [] def run(self): self.run_command('egg_info') -- cgit v1.2.1 From 199a482b6127e3e896809cbb82486ef167985da0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 9 Sep 2014 09:38:58 -0400 Subject: Move sister functions into proximity --- pkg_resources.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkg_resources.py b/pkg_resources.py index ee2c553b..23ac1a36 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -81,15 +81,6 @@ try: except ImportError: pass -def _bypass_ensure_directory(name, mode=0o777): - # Sandbox-bypassing version of ensure_directory() - if not WRITE_SUPPORT: - raise IOError('"os.mkdir" not supported on this platform.') - dirname, filename = split(name) - if dirname and filename and not isdir(dirname): - _bypass_ensure_directory(dirname) - mkdir(dirname, mode) - _state_vars = {} @@ -2824,6 +2815,17 @@ def ensure_directory(path): if not os.path.isdir(dirname): os.makedirs(dirname) + +def _bypass_ensure_directory(name, mode=0o777): + """Sandbox-bypassing version of ensure_directory()""" + if not WRITE_SUPPORT: + raise IOError('"os.mkdir" not supported on this platform.') + dirname, filename = split(name) + if dirname and filename and not isdir(dirname): + _bypass_ensure_directory(dirname) + mkdir(dirname, mode) + + def split_sections(s): """Split a string or iterable thereof into (section, content) pairs -- cgit v1.2.1 From c689acd8690d72a8d59085abbac98a41896f43c0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 9 Sep 2014 09:39:47 -0400 Subject: Rename argument for consistency --HG-- extra : amend_source : 006c17fc01743ef7f646bf54a166cbaeae92ab75 --- pkg_resources.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg_resources.py b/pkg_resources.py index 23ac1a36..08983919 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -2816,11 +2816,11 @@ def ensure_directory(path): os.makedirs(dirname) -def _bypass_ensure_directory(name, mode=0o777): +def _bypass_ensure_directory(path, mode=0o777): """Sandbox-bypassing version of ensure_directory()""" if not WRITE_SUPPORT: raise IOError('"os.mkdir" not supported on this platform.') - dirname, filename = split(name) + dirname, filename = split(path) if dirname and filename and not isdir(dirname): _bypass_ensure_directory(dirname) mkdir(dirname, mode) -- cgit v1.2.1 From da99f1334e36171fdd2c4bbb7dee4845c6ad7dc5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:13:18 -0400 Subject: Add indicators for PY2 vs. PY3 --HG-- extra : rebase_source : 549637a713aba52da4c87f1a84436832eba82f1e --- pkg_resources.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg_resources.py b/pkg_resources.py index 08983919..9992b17d 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -35,6 +35,9 @@ import email.parser import tempfile from pkgutil import get_importer +PY3 = sys.version_info > (3,) +PY2 = not PY3 + try: from urlparse import urlparse, urlunparse except ImportError: -- cgit v1.2.1 From 26e4f9534a35fc13ec2c5e111e639d4af03e5644 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:16:33 -0400 Subject: Remove conditional import for frozenset (available in Python 2.6+) --- pkg_resources.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg_resources.py b/pkg_resources.py index 9992b17d..a0566688 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -43,10 +43,6 @@ try: except ImportError: from urllib.parse import urlparse, urlunparse -try: - frozenset -except NameError: - from sets import ImmutableSet as frozenset try: basestring next = lambda o: o.next() -- cgit v1.2.1 From 8f56e928f03f69a5e787f830c04714467307601e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:21:24 -0400 Subject: Use PY3/PY2 indicators to reliably select behavior. Fixes #237 --HG-- extra : amend_source : 33f3d298acd39933ccf60810902feb2a5d51c793 --- CHANGES.txt | 8 ++++++++ pkg_resources.py | 17 +++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 83b05bbe..185052fb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,14 @@ CHANGES ======= +--- +5.8 +--- + +* Issue #237: ``pkg_resources`` now uses explicit detection of Python 2 vs. + Python 3, supporting environments where builtins have been patched to make + Python 3 look more like Python 2. + --- 5.7 --- diff --git a/pkg_resources.py b/pkg_resources.py index a0566688..5dcfd66e 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -38,16 +38,13 @@ from pkgutil import get_importer PY3 = sys.version_info > (3,) PY2 = not PY3 -try: - from urlparse import urlparse, urlunparse -except ImportError: +if PY3: from urllib.parse import urlparse, urlunparse -try: - basestring - next = lambda o: o.next() - from cStringIO import StringIO as BytesIO -except NameError: +if PY2: + from urlparse import urlparse, urlunparse + +if PY3: basestring = str from io import BytesIO def execfile(fn, globs=None, locs=None): @@ -57,6 +54,10 @@ except NameError: locs = globs exec(compile(open(fn).read(), fn, 'exec'), globs, locs) +if PY2: + next = lambda o: o.next() + from cStringIO import StringIO as BytesIO + # capture these to bypass sandboxing from os import utime try: -- cgit v1.2.1 From a2201d3d5a74ea034caf2f6eeeb877708e9017bf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:25:45 -0400 Subject: next function and io module are available on Python 2.6 --- pkg_resources.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg_resources.py b/pkg_resources.py index 5dcfd66e..d8c73320 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -16,6 +16,7 @@ method. import sys import os +import io import time import re import imp @@ -46,7 +47,6 @@ if PY2: if PY3: basestring = str - from io import BytesIO def execfile(fn, globs=None, locs=None): if globs is None: globs = globals() @@ -54,10 +54,6 @@ if PY3: locs = globs exec(compile(open(fn).read(), fn, 'exec'), globs, locs) -if PY2: - next = lambda o: o.next() - from cStringIO import StringIO as BytesIO - # capture these to bypass sandboxing from os import utime try: @@ -1378,7 +1374,7 @@ class NullProvider: return self._fn(self.module_path, resource_name) def get_resource_stream(self, manager, resource_name): - return BytesIO(self.get_resource_string(manager, resource_name)) + return io.BytesIO(self.get_resource_string(manager, resource_name)) def get_resource_string(self, manager, resource_name): return self._get(self._fn(self.module_path, resource_name)) -- cgit v1.2.1 From 5d3002955232bb6a2b83faee486cd362dbbf8fa3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:31:09 -0400 Subject: Use the term 'string_types', following the pattern in six --HG-- extra : amend_source : 3a4aeb2627549c3dfec15067579eccc8e1314de2 --- pkg_resources.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg_resources.py b/pkg_resources.py index d8c73320..825b3004 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -46,13 +46,15 @@ if PY2: from urlparse import urlparse, urlunparse if PY3: - basestring = str + string_types = str, def execfile(fn, globs=None, locs=None): if globs is None: globs = globals() if locs is None: locs = globs exec(compile(open(fn).read(), fn, 'exec'), globs, locs) +else: + string_types = str, eval('unicode') # capture these to bypass sandboxing from os import utime @@ -330,7 +332,7 @@ run_main = run_script def get_distribution(dist): """Return a current distribution object for a Requirement or string""" - if isinstance(dist, basestring): + if isinstance(dist, string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) @@ -2050,8 +2052,8 @@ def _set_parent_ns(packageName): def yield_lines(strs): - """Yield non-empty/non-comment lines of a ``basestring`` or sequence""" - if isinstance(strs, basestring): + """Yield non-empty/non-comment lines of a string or sequence""" + if isinstance(strs, string_types): for s in strs.splitlines(): s = s.strip() # skip blank lines/comments @@ -2643,8 +2645,7 @@ def issue_warning(*args,**kw): def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` - `strs` must be an instance of ``basestring``, or a (possibly-nested) - iterable thereof. + `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) @@ -2745,7 +2746,7 @@ class Requirement: # only get if we need it if self.index: item = item.parsed_version - elif isinstance(item, basestring): + elif isinstance(item, string_types): item = parse_version(item) last = None # -1, 0, 1 -- cgit v1.2.1 From d1bcc3545099d652f07fc13e1cfb449d0ed87d58 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:34:23 -0400 Subject: Remove execfile compatibility - unnecessary on Python 2.6+ --HG-- extra : amend_source : 8a0dcd07e62a327647c834a44fe73b8ebc7b53b9 --- pkg_resources.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg_resources.py b/pkg_resources.py index 825b3004..517298c9 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -47,12 +47,6 @@ if PY2: if PY3: string_types = str, - def execfile(fn, globs=None, locs=None): - if globs is None: - globs = globals() - if locs is None: - locs = globs - exec(compile(open(fn).read(), fn, 'exec'), globs, locs) else: string_types = str, eval('unicode') @@ -1424,7 +1418,9 @@ class NullProvider: script_filename = self._fn(self.egg_info, script) namespace['__file__'] = script_filename if os.path.exists(script_filename): - execfile(script_filename, namespace, namespace) + source = open(script_filename).read() + code = compile(source, script_filename, 'exec') + exec(code, namespace, namespace) else: from linecache import cache cache[script_filename] = ( -- cgit v1.2.1 From ea26aa25a738d9c805fd5b44b053138f0e560c20 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:39:44 -0400 Subject: Added tag 5.8 for changeset 67550a8ed9f4 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 1f1cac00..17532221 100644 --- a/.hgtags +++ b/.hgtags @@ -153,3 +153,4 @@ ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 949a66af4f03521e1404deda940aa951418a13d2 5.5.1 a1fc0220bfa3581158688789f6dfdc00672eb99b 5.6 37ed55fd310d0cd32009dc5676121e86b404a23d 5.7 +67550a8ed9f4ef49ee5a31f433adbf5a0eaeccf9 5.8 -- cgit v1.2.1 From 394ea0c104e7da5cf583680b418c3e5e4b9858d4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 18 Sep 2014 07:40:48 -0400 Subject: Bumped to 5.9 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 74c8224a..0fd1c872 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.8" +DEFAULT_VERSION = "5.9" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 868f2d33..7244139e 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.8' +__version__ = '5.9' -- cgit v1.2.1 From 4e5c7d0657a9719d2fa961c852daf0926de91ae3 Mon Sep 17 00:00:00 2001 From: Randy Syring Date: Sat, 20 Sep 2014 16:29:41 -0400 Subject: sdist command: fix case insensitivity when adding some files to filelist This should fix the problem in Bitbucket issue #100. It gives the same behavior for inclusion of default files (README*, etc.) on Windows as Linux. BACKWARDS INCOMPATABILITY: This may result in a backwards incompatible change for users on a case insensitive file system. If they were relying on some files getting included in their distribution due to setuptools defaults, and their files do not have the same case as the files being looked for in setuptools, those files will no longer be included in the package. For example, if a package had a file: readme.rst Previous to this commit, that file would have been included in the distribution as: README.rst But it will now no longer be included at all. To get the file included in the package, it can be added to the package's MANIFEST.in file: include readme.rst Files affected by this change will have a case variant of the files or patterns listed below: README README.txt README.rst setup.py (or whatever your setuptools script is named) setup.cfg test/test*.py --- setuptools/command/sdist.py | 11 +++++++---- setuptools/tests/test_sdist.py | 28 ++++++++++++++++++++++++++++ setuptools/utils.py | 11 +++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 setuptools/utils.py diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 2aa1ee20..dc8d6773 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -8,6 +8,8 @@ import sys from setuptools import svn_utils from setuptools.compat import PY3 +from setuptools.utils import cs_path_exists + import pkg_resources READMES = ('README', 'README.rst', 'README.txt') @@ -146,7 +148,7 @@ class sdist(orig.sdist): alts = fn got_it = 0 for fn in alts: - if os.path.exists(fn): + if cs_path_exists(fn): got_it = 1 self.filelist.append(fn) break @@ -155,16 +157,17 @@ class sdist(orig.sdist): self.warn("standard file not found: should have one of " + ', '.join(alts)) else: - if os.path.exists(fn): + if cs_path_exists(fn): self.filelist.append(fn) else: self.warn("standard file '%s' not found" % fn) optional = ['test/test*.py', 'setup.cfg'] for pattern in optional: - files = list(filter(os.path.isfile, glob(pattern))) + files = list(filter(cs_path_exists, glob(pattern))) if files: - self.filelist.extend(files) + actual_fnames = map(os.path.normcase, files) + self.filelist.extend(actual_fnames) # getting python files if self.distribution.has_pure_modules(): diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py index 5b3862e9..5f8a190f 100644 --- a/setuptools/tests/test_sdist.py +++ b/setuptools/tests/test_sdist.py @@ -86,6 +86,7 @@ class TestSdistTest(unittest.TestCase): f = open(os.path.join(self.temp_dir, 'setup.py'), 'w') f.write(SETUP_PY) f.close() + # Set up the rest of the test package test_pkg = os.path.join(self.temp_dir, 'sdist_test') os.mkdir(test_pkg) @@ -121,6 +122,33 @@ class TestSdistTest(unittest.TestCase): self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest) self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest) + + def test_defaults_case_sensitivity(self): + """ + Make sure default files (README.*, etc.) are added in a case-sensitive + way to avoid problems with packages built on Windows. + """ + + open(os.path.join(self.temp_dir, 'readme.rst'), 'w').close() + open(os.path.join(self.temp_dir, 'SETUP.cfg'), 'w').close() + + dist = Distribution(SETUP_ATTRS) + # the extension deliberately capitalized for this test + # to make sure the actual filename (not capitalized) gets added + # to the manifest + dist.script_name = 'setup.PY' + cmd = sdist(dist) + cmd.ensure_finalized() + + with quiet(): + cmd.run() + + # lowercase all names so we can test in a case-insensitive way to make sure the files are not included + manifest = map(lambda x: x.lower(), cmd.filelist.files) + self.assertFalse('readme.rst' in manifest, manifest) + self.assertFalse('setup.py' in manifest, manifest) + self.assertFalse('setup.cfg' in manifest, manifest) + def test_manifest_is_written_with_utf8_encoding(self): # Test for #303. dist = Distribution(SETUP_ATTRS) diff --git a/setuptools/utils.py b/setuptools/utils.py new file mode 100644 index 00000000..91e4b87f --- /dev/null +++ b/setuptools/utils.py @@ -0,0 +1,11 @@ +import os +import os.path + + +def cs_path_exists(fspath): + if not os.path.exists(fspath): + return False + # make absolute so we always have a directory + abspath = os.path.abspath(fspath) + directory, filename = os.path.split(abspath) + return filename in os.listdir(directory) \ No newline at end of file -- cgit v1.2.1 From 1c05e6a7b7f2a54a55285857d498409df3dc9383 Mon Sep 17 00:00:00 2001 From: Randy Syring Date: Sat, 20 Sep 2014 16:37:25 -0400 Subject: remove unneeded code from last commit --- setuptools/command/sdist.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index dc8d6773..a77c39f2 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -166,8 +166,7 @@ class sdist(orig.sdist): for pattern in optional: files = list(filter(cs_path_exists, glob(pattern))) if files: - actual_fnames = map(os.path.normcase, files) - self.filelist.extend(actual_fnames) + self.filelist.extend(files) # getting python files if self.distribution.has_pure_modules(): -- cgit v1.2.1 From d42aea783a347d431eaf293250bab60c05b4c779 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 24 Sep 2014 00:22:22 -0400 Subject: Update changelog --- CHANGES.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 185052fb..a6e27372 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,28 @@ CHANGES ======= +--- +6.0 +--- + +* Issue #100: When building a distribution, Setuptools will no longer match + default files using platform-dependent case sensitivity, but rather will + only match the files if their case matches exactly. As a result, on Windows + and other case-insensitive file systems, files with names such as + 'readme.txt' or 'README.TXT' will be omitted from the distribution and a + warning will be issued indicating that 'README.txt' was not found. Other + filenames affected are: + + - README.rst + - README + - setup.cfg + - setup.py (or the script name) + - test/test*.py + + Any users producing distributions with filenames that match those above + case-insensitively, but not case-sensitively, should rename those files in + their repository for better portability. + --- 5.8 --- -- cgit v1.2.1 From b0f93f3bdd1d67cce1dd03d4a6ecea8256fa4e55 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 25 Sep 2014 08:46:53 -0700 Subject: Adds monkeypatching for msvc9compiler.find_vcvarsall() to look for a standalone compiler installation and improves the error message for missing VC installation. --- setuptools/extension.py | 54 +++++++++++++ setuptools/tests/test_msvc9compiler.py | 135 +++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 setuptools/tests/test_msvc9compiler.py diff --git a/setuptools/extension.py b/setuptools/extension.py index ab5908da..41a817b7 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -2,12 +2,66 @@ import sys import re import functools import distutils.core +import distutils.errors import distutils.extension +import distutils.msvc9compiler from setuptools.dist import _get_unpatched _Extension = _get_unpatched(distutils.core.Extension) +def _patch_msvc9compiler_find_vcvarsall(): + """ + Looks for the standalone VC for Python before falling back on + distutils's original approach. + """ + VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' + find_vcvarsall = distutils.msvc9compiler.find_vcvarsall + query_vcvarsall = distutils.msvc9compiler.query_vcvarsall + if find_vcvarsall and find_vcvarsall.__module__.startswith('setuptools.'): + # Already patched + return + + def _find_vcvarsall(version): + Reg = distutils.msvc9compiler.Reg + try: + # Per-user installs register the compiler path here + productdir = Reg.get_value(VC_BASE % ('', version), "installdir") + except KeyError: + try: + # All-user installs on a 64-bit system register here + productdir = Reg.get_value(VC_BASE % ('Wow6432Node\\', version), "installdir") + except KeyError: + productdir = None + + if productdir: + import os + vcvarsall = os.path.join(productdir, "vcvarsall.bat") + if os.path.isfile(vcvarsall): + return vcvarsall + + return find_vcvarsall(version) + + def _query_vcvarsall(version, *args, **kwargs): + try: + return query_vcvarsall(version, *args, **kwargs) + except distutils.errors.DistutilsPlatformError: + exc = sys.exc_info()[1] + if exc and "vcvarsall.bat" in exc.args[0]: + message = 'Microsoft Visual C++ %0.1f is required (%s).' % (version, exc.args[0]) + if int(version) == 9: + # This redirection link is maintained by Microsoft. + # Contact vspython@microsoft.com if it needs updating. + raise distutils.errors.DistutilsPlatformError( + message + ' Get it from http://aka.ms/vcpython27' + ) + raise distutils.errors.DistutilsPlatformError(message) + raise + + distutils.msvc9compiler.find_vcvarsall = _find_vcvarsall + distutils.msvc9compiler.query_vcvarsall = _query_vcvarsall +_patch_msvc9compiler_find_vcvarsall() + def have_pyrex(): """ Return True if Cython or Pyrex can be imported. diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py new file mode 100644 index 00000000..272e99e8 --- /dev/null +++ b/setuptools/tests/test_msvc9compiler.py @@ -0,0 +1,135 @@ +"""msvc9compiler monkey patch test + +This test ensures that importing setuptools is sufficient to replace +the standard find_vcvarsall function with our patched version that +finds the Visual C++ for Python package. +""" + +import os +import shutil +import sys +import tempfile +import unittest + +try: + from winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE +except ImportError: + from _winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE + +import distutils.msvc9compiler +from distutils.errors import DistutilsPlatformError + +# importing only setuptools should apply the patch +import setuptools + +class MockReg: + """Mock for distutils.msvc9compiler.Reg. We patch it + with an instance of this class that mocks out the + functions that access the registry. + """ + + def __init__(self, hkey_local_machine={}, hkey_current_user={}): + self.hklm = hkey_local_machine + self.hkcu = hkey_current_user + + def __enter__(self): + self.original_read_keys = distutils.msvc9compiler.Reg.read_keys + self.original_read_values = distutils.msvc9compiler.Reg.read_values + + hives = { + HKEY_CURRENT_USER: self.hkcu, + HKEY_LOCAL_MACHINE: self.hklm, + } + + def read_keys(cls, base, key): + """Return list of registry keys.""" + hive = hives.get(base, {}) + return [k.rpartition('\\')[2] + for k in hive if k.startswith(key.lower())] + + def read_values(cls, base, key): + """Return dict of registry keys and values.""" + hive = hives.get(base, {}) + return dict((k.rpartition('\\')[2], hive[k]) + for k in hive if k.startswith(key.lower())) + + distutils.msvc9compiler.Reg.read_keys = classmethod(read_keys) + distutils.msvc9compiler.Reg.read_values = classmethod(read_values) + + return self + + def __exit__(self, exc_type, exc_value, exc_tb): + distutils.msvc9compiler.Reg.read_keys = self.original_read_keys + distutils.msvc9compiler.Reg.read_values = self.original_read_values + +class TestMSVC9Compiler(unittest.TestCase): + + def test_find_vcvarsall_patch(self): + self.assertEqual( + "setuptools.extension", + distutils.msvc9compiler.find_vcvarsall.__module__, + "find_vcvarsall was not patched" + ) + + find_vcvarsall = distutils.msvc9compiler.find_vcvarsall + query_vcvarsall = distutils.msvc9compiler.query_vcvarsall + + # No registry entries or environment variable means we should + # not find anything + old_value = os.environ.pop("VS90COMNTOOLS", None) + try: + with MockReg(): + self.assertIsNone(find_vcvarsall(9.0)) + + try: + query_vcvarsall(9.0) + self.fail('Expected DistutilsPlatformError from query_vcvarsall()') + except DistutilsPlatformError: + exc_message = str(sys.exc_info()[1]) + self.assertIn('aka.ms/vcpython27', exc_message) + finally: + if old_value: + os.environ["VS90COMNTOOLS"] = old_value + + key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir' + key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir' + + # Make two mock files so we can tell whether HCKU entries are + # preferred to HKLM entries. + mock_installdir_1 = tempfile.mkdtemp() + mock_vcvarsall_bat_1 = os.path.join(mock_installdir_1, 'vcvarsall.bat') + open(mock_vcvarsall_bat_1, 'w').close() + mock_installdir_2 = tempfile.mkdtemp() + mock_vcvarsall_bat_2 = os.path.join(mock_installdir_2, 'vcvarsall.bat') + open(mock_vcvarsall_bat_2, 'w').close() + try: + # Ensure we get the current user's setting first + with MockReg( + hkey_current_user={ key_32: mock_installdir_1 }, + hkey_local_machine={ + key_32: mock_installdir_2, + key_64: mock_installdir_2, + } + ): + self.assertEqual(mock_vcvarsall_bat_1, find_vcvarsall(9.0)) + + # Ensure we get the local machine value if it's there + with MockReg(hkey_local_machine={ key_32: mock_installdir_2 }): + self.assertEqual(mock_vcvarsall_bat_2, find_vcvarsall(9.0)) + + # Ensure we prefer the 64-bit local machine key + # (*not* the Wow6432Node key) + with MockReg( + hkey_local_machine={ + # This *should* only exist on 32-bit machines + key_32: mock_installdir_1, + # This *should* only exist on 64-bit machines + key_64: mock_installdir_2, + } + ): + self.assertEqual(mock_vcvarsall_bat_1, find_vcvarsall(9.0)) + finally: + shutil.rmtree(mock_installdir_1) + shutil.rmtree(mock_installdir_2) + + \ No newline at end of file -- cgit v1.2.1 From ec9cf181ba29c444f8fdf4cdd109f30185d69b51 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 11:24:40 -0400 Subject: Update changelog --- CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 4b20333d..3a0e6936 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -27,6 +27,8 @@ CHANGES exclusion list now includes Python 3.2 ``__pycache__`` entries. * Pull Request #76 and Pull Request #78: lines in top_level.txt are now ordered deterministically. +* Issue #118: The egg-info directory is now no longer included in the list + of outputs. --- 5.8 -- cgit v1.2.1 From 442e0b23457b68a188cc75e4c885a244251c4a9c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 11:29:50 -0400 Subject: Update changelog --- CHANGES.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 3a0e6936..ab58bb14 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -29,6 +29,9 @@ CHANGES ordered deterministically. * Issue #118: The egg-info directory is now no longer included in the list of outputs. +* Pull Request #83: Setuptools now patches distutils msvc9compiler to + recognize the specially-packaged compiler package for easy extension module + support on Python 2.6, 2.7, and 3.2. --- 5.8 -- cgit v1.2.1 From 0e2681c1782320311e8cf144d4df923cfafc48c4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 11:30:01 -0400 Subject: Resave with excess whitespace removed --- setuptools/extension.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setuptools/extension.py b/setuptools/extension.py index 41a817b7..c695976a 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -21,7 +21,7 @@ def _patch_msvc9compiler_find_vcvarsall(): if find_vcvarsall and find_vcvarsall.__module__.startswith('setuptools.'): # Already patched return - + def _find_vcvarsall(version): Reg = distutils.msvc9compiler.Reg try: @@ -33,15 +33,15 @@ def _patch_msvc9compiler_find_vcvarsall(): productdir = Reg.get_value(VC_BASE % ('Wow6432Node\\', version), "installdir") except KeyError: productdir = None - + if productdir: import os vcvarsall = os.path.join(productdir, "vcvarsall.bat") if os.path.isfile(vcvarsall): return vcvarsall - + return find_vcvarsall(version) - + def _query_vcvarsall(version, *args, **kwargs): try: return query_vcvarsall(version, *args, **kwargs) -- cgit v1.2.1 From fb6baa09e5089c3984ee38da5f96b857c7e90c8f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 15:17:55 -0400 Subject: Move monkey patch to a separate module --- setuptools/extension.py | 56 +++------------------------------------------ setuptools/msvc9_support.py | 55 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 53 deletions(-) create mode 100644 setuptools/msvc9_support.py diff --git a/setuptools/extension.py b/setuptools/extension.py index c695976a..8178ed33 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -4,63 +4,13 @@ import functools import distutils.core import distutils.errors import distutils.extension -import distutils.msvc9compiler -from setuptools.dist import _get_unpatched +from .dist import _get_unpatched +from . import msvc9_support _Extension = _get_unpatched(distutils.core.Extension) -def _patch_msvc9compiler_find_vcvarsall(): - """ - Looks for the standalone VC for Python before falling back on - distutils's original approach. - """ - VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' - find_vcvarsall = distutils.msvc9compiler.find_vcvarsall - query_vcvarsall = distutils.msvc9compiler.query_vcvarsall - if find_vcvarsall and find_vcvarsall.__module__.startswith('setuptools.'): - # Already patched - return - - def _find_vcvarsall(version): - Reg = distutils.msvc9compiler.Reg - try: - # Per-user installs register the compiler path here - productdir = Reg.get_value(VC_BASE % ('', version), "installdir") - except KeyError: - try: - # All-user installs on a 64-bit system register here - productdir = Reg.get_value(VC_BASE % ('Wow6432Node\\', version), "installdir") - except KeyError: - productdir = None - - if productdir: - import os - vcvarsall = os.path.join(productdir, "vcvarsall.bat") - if os.path.isfile(vcvarsall): - return vcvarsall - - return find_vcvarsall(version) - - def _query_vcvarsall(version, *args, **kwargs): - try: - return query_vcvarsall(version, *args, **kwargs) - except distutils.errors.DistutilsPlatformError: - exc = sys.exc_info()[1] - if exc and "vcvarsall.bat" in exc.args[0]: - message = 'Microsoft Visual C++ %0.1f is required (%s).' % (version, exc.args[0]) - if int(version) == 9: - # This redirection link is maintained by Microsoft. - # Contact vspython@microsoft.com if it needs updating. - raise distutils.errors.DistutilsPlatformError( - message + ' Get it from http://aka.ms/vcpython27' - ) - raise distutils.errors.DistutilsPlatformError(message) - raise - - distutils.msvc9compiler.find_vcvarsall = _find_vcvarsall - distutils.msvc9compiler.query_vcvarsall = _query_vcvarsall -_patch_msvc9compiler_find_vcvarsall() +msvc9_support.patch_for_specialized_compiler() def have_pyrex(): """ diff --git a/setuptools/msvc9_support.py b/setuptools/msvc9_support.py new file mode 100644 index 00000000..fba2a71a --- /dev/null +++ b/setuptools/msvc9_support.py @@ -0,0 +1,55 @@ +import sys + +import distutils.msvc9compiler + +def patch_for_specialized_compiler(): + """ + Patch functions in distutils.msvc9compiler to use the standalone compiler + build for Python (Windows only). Fall back to original behavior when the + standalone compiler is not available. + """ + VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' + find_vcvarsall = distutils.msvc9compiler.find_vcvarsall + query_vcvarsall = distutils.msvc9compiler.query_vcvarsall + if find_vcvarsall and find_vcvarsall.__module__.startswith('setuptools.'): + # Already patched + return + + def _find_vcvarsall(version): + Reg = distutils.msvc9compiler.Reg + try: + # Per-user installs register the compiler path here + productdir = Reg.get_value(VC_BASE % ('', version), "installdir") + except KeyError: + try: + # All-user installs on a 64-bit system register here + productdir = Reg.get_value(VC_BASE % ('Wow6432Node\\', version), "installdir") + except KeyError: + productdir = None + + if productdir: + import os + vcvarsall = os.path.join(productdir, "vcvarsall.bat") + if os.path.isfile(vcvarsall): + return vcvarsall + + return find_vcvarsall(version) + + def _query_vcvarsall(version, *args, **kwargs): + try: + return query_vcvarsall(version, *args, **kwargs) + except distutils.errors.DistutilsPlatformError: + exc = sys.exc_info()[1] + if exc and "vcvarsall.bat" in exc.args[0]: + message = 'Microsoft Visual C++ %0.1f is required (%s).' % (version, exc.args[0]) + if int(version) == 9: + # This redirection link is maintained by Microsoft. + # Contact vspython@microsoft.com if it needs updating. + raise distutils.errors.DistutilsPlatformError( + message + ' Get it from http://aka.ms/vcpython27' + ) + raise distutils.errors.DistutilsPlatformError(message) + raise + + distutils.msvc9compiler.find_vcvarsall = _find_vcvarsall + distutils.msvc9compiler.query_vcvarsall = _query_vcvarsall -- cgit v1.2.1 From c735886bf4433d26f8c0679b722e46393a1dd92a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 15:21:56 -0400 Subject: Protect against import errors. --- setuptools/msvc9_support.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setuptools/msvc9_support.py b/setuptools/msvc9_support.py index fba2a71a..f2e5cffc 100644 --- a/setuptools/msvc9_support.py +++ b/setuptools/msvc9_support.py @@ -1,13 +1,17 @@ import sys -import distutils.msvc9compiler - def patch_for_specialized_compiler(): """ Patch functions in distutils.msvc9compiler to use the standalone compiler build for Python (Windows only). Fall back to original behavior when the standalone compiler is not available. """ + try: + distutils = __import__('distutils.msvc9compiler') + except ImportError: + # The module isn't available to be patched + return + VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' find_vcvarsall = distutils.msvc9compiler.find_vcvarsall query_vcvarsall = distutils.msvc9compiler.query_vcvarsall -- cgit v1.2.1 From 15f29791a68addcb4e6166cd43f67c1f656f82d3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 17:08:20 -0400 Subject: Extract patched functions as top-level functions --- setuptools/msvc9_support.py | 78 ++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/setuptools/msvc9_support.py b/setuptools/msvc9_support.py index f2e5cffc..61ca8579 100644 --- a/setuptools/msvc9_support.py +++ b/setuptools/msvc9_support.py @@ -1,59 +1,63 @@ import sys +distutils = None +unpatched = dict() + def patch_for_specialized_compiler(): """ Patch functions in distutils.msvc9compiler to use the standalone compiler build for Python (Windows only). Fall back to original behavior when the standalone compiler is not available. """ + global distutils try: distutils = __import__('distutils.msvc9compiler') except ImportError: # The module isn't available to be patched return - VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' - find_vcvarsall = distutils.msvc9compiler.find_vcvarsall - query_vcvarsall = distutils.msvc9compiler.query_vcvarsall - if find_vcvarsall and find_vcvarsall.__module__.startswith('setuptools.'): + if unpatched: # Already patched return - def _find_vcvarsall(version): - Reg = distutils.msvc9compiler.Reg + unpatched.update(vars(distutils.msvc9compiler)) + + distutils.msvc9compiler.find_vcvarsall = find_vcvarsall + distutils.msvc9compiler.query_vcvarsall = query_vcvarsall + +def find_vcvarsall(version): + Reg = distutils.msvc9compiler.Reg + VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' + try: + # Per-user installs register the compiler path here + productdir = Reg.get_value(VC_BASE % ('', version), "installdir") + except KeyError: try: - # Per-user installs register the compiler path here - productdir = Reg.get_value(VC_BASE % ('', version), "installdir") + # All-user installs on a 64-bit system register here + productdir = Reg.get_value(VC_BASE % ('Wow6432Node\\', version), "installdir") except KeyError: - try: - # All-user installs on a 64-bit system register here - productdir = Reg.get_value(VC_BASE % ('Wow6432Node\\', version), "installdir") - except KeyError: - productdir = None + productdir = None - if productdir: - import os - vcvarsall = os.path.join(productdir, "vcvarsall.bat") - if os.path.isfile(vcvarsall): - return vcvarsall + if productdir: + import os + vcvarsall = os.path.join(productdir, "vcvarsall.bat") + if os.path.isfile(vcvarsall): + return vcvarsall - return find_vcvarsall(version) + return unpatched['find_vcvarsall'](version) - def _query_vcvarsall(version, *args, **kwargs): - try: - return query_vcvarsall(version, *args, **kwargs) - except distutils.errors.DistutilsPlatformError: - exc = sys.exc_info()[1] - if exc and "vcvarsall.bat" in exc.args[0]: - message = 'Microsoft Visual C++ %0.1f is required (%s).' % (version, exc.args[0]) - if int(version) == 9: - # This redirection link is maintained by Microsoft. - # Contact vspython@microsoft.com if it needs updating. - raise distutils.errors.DistutilsPlatformError( - message + ' Get it from http://aka.ms/vcpython27' - ) - raise distutils.errors.DistutilsPlatformError(message) - raise - - distutils.msvc9compiler.find_vcvarsall = _find_vcvarsall - distutils.msvc9compiler.query_vcvarsall = _query_vcvarsall +def query_vcvarsall(version, *args, **kwargs): + try: + return unpatched['query_vcvarsall'](version, *args, **kwargs) + except distutils.errors.DistutilsPlatformError: + exc = sys.exc_info()[1] + if exc and "vcvarsall.bat" in exc.args[0]: + message = 'Microsoft Visual C++ %0.1f is required (%s).' % (version, exc.args[0]) + if int(version) == 9: + # This redirection link is maintained by Microsoft. + # Contact vspython@microsoft.com if it needs updating. + raise distutils.errors.DistutilsPlatformError( + message + ' Get it from http://aka.ms/vcpython27' + ) + raise distutils.errors.DistutilsPlatformError(message) + raise -- cgit v1.2.1 From 84376ed5bb61c4a8a25048c83ad8d9fa60618db5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 17:09:44 -0400 Subject: Create global import more traditionally. Now the patched functions are available directly as well. --- setuptools/msvc9_support.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/setuptools/msvc9_support.py b/setuptools/msvc9_support.py index 61ca8579..d0be70e2 100644 --- a/setuptools/msvc9_support.py +++ b/setuptools/msvc9_support.py @@ -1,6 +1,10 @@ import sys -distutils = None +try: + import distutils.msvc9compiler +except ImportError: + pass + unpatched = dict() def patch_for_specialized_compiler(): @@ -9,10 +13,7 @@ def patch_for_specialized_compiler(): build for Python (Windows only). Fall back to original behavior when the standalone compiler is not available. """ - global distutils - try: - distutils = __import__('distutils.msvc9compiler') - except ImportError: + if 'distutils' not in globals(): # The module isn't available to be patched return -- cgit v1.2.1 From 2d58fe235143f63f56e1207ab51e8ea6df1bb04d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 18:14:44 -0400 Subject: Remove excess whitespace --HG-- extra : amend_source : b8e14d29b2a36b84e30e22cf231d0b1730eeb7f4 --- setuptools/tests/test_msvc9compiler.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 272e99e8..33dca836 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -27,20 +27,20 @@ class MockReg: with an instance of this class that mocks out the functions that access the registry. """ - + def __init__(self, hkey_local_machine={}, hkey_current_user={}): self.hklm = hkey_local_machine self.hkcu = hkey_current_user - + def __enter__(self): self.original_read_keys = distutils.msvc9compiler.Reg.read_keys self.original_read_values = distutils.msvc9compiler.Reg.read_values - + hives = { HKEY_CURRENT_USER: self.hkcu, HKEY_LOCAL_MACHINE: self.hklm, } - + def read_keys(cls, base, key): """Return list of registry keys.""" hive = hives.get(base, {}) @@ -52,12 +52,12 @@ class MockReg: hive = hives.get(base, {}) return dict((k.rpartition('\\')[2], hive[k]) for k in hive if k.startswith(key.lower())) - + distutils.msvc9compiler.Reg.read_keys = classmethod(read_keys) distutils.msvc9compiler.Reg.read_values = classmethod(read_values) - + return self - + def __exit__(self, exc_type, exc_value, exc_tb): distutils.msvc9compiler.Reg.read_keys = self.original_read_keys distutils.msvc9compiler.Reg.read_values = self.original_read_values @@ -80,7 +80,7 @@ class TestMSVC9Compiler(unittest.TestCase): try: with MockReg(): self.assertIsNone(find_vcvarsall(9.0)) - + try: query_vcvarsall(9.0) self.fail('Expected DistutilsPlatformError from query_vcvarsall()') @@ -90,10 +90,10 @@ class TestMSVC9Compiler(unittest.TestCase): finally: if old_value: os.environ["VS90COMNTOOLS"] = old_value - + key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir' key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir' - + # Make two mock files so we can tell whether HCKU entries are # preferred to HKLM entries. mock_installdir_1 = tempfile.mkdtemp() @@ -105,7 +105,7 @@ class TestMSVC9Compiler(unittest.TestCase): try: # Ensure we get the current user's setting first with MockReg( - hkey_current_user={ key_32: mock_installdir_1 }, + hkey_current_user={key_32: mock_installdir_1}, hkey_local_machine={ key_32: mock_installdir_2, key_64: mock_installdir_2, @@ -114,7 +114,7 @@ class TestMSVC9Compiler(unittest.TestCase): self.assertEqual(mock_vcvarsall_bat_1, find_vcvarsall(9.0)) # Ensure we get the local machine value if it's there - with MockReg(hkey_local_machine={ key_32: mock_installdir_2 }): + with MockReg(hkey_local_machine={key_32: mock_installdir_2}): self.assertEqual(mock_vcvarsall_bat_2, find_vcvarsall(9.0)) # Ensure we prefer the 64-bit local machine key @@ -131,5 +131,3 @@ class TestMSVC9Compiler(unittest.TestCase): finally: shutil.rmtree(mock_installdir_1) shutil.rmtree(mock_installdir_2) - - \ No newline at end of file -- cgit v1.2.1 From d195bc900beccb22c8de243416c40564ea28402f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 18:25:32 -0400 Subject: Remove unused import --- setuptools/tests/test_msvc9compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 33dca836..3a2ef970 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -20,7 +20,7 @@ import distutils.msvc9compiler from distutils.errors import DistutilsPlatformError # importing only setuptools should apply the patch -import setuptools +__import__('setuptools') class MockReg: """Mock for distutils.msvc9compiler.Reg. We patch it -- cgit v1.2.1 From e87ba1aa48bb891bb29704d321754623956fef44 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 18:30:14 -0400 Subject: Move stable import into stdlib imports section --- setuptools/tests/test_msvc9compiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 3a2ef970..74b5220b 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -10,6 +10,7 @@ import shutil import sys import tempfile import unittest +import distutils.errors try: from winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE @@ -17,7 +18,6 @@ except ImportError: from _winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE import distutils.msvc9compiler -from distutils.errors import DistutilsPlatformError # importing only setuptools should apply the patch __import__('setuptools') @@ -84,7 +84,7 @@ class TestMSVC9Compiler(unittest.TestCase): try: query_vcvarsall(9.0) self.fail('Expected DistutilsPlatformError from query_vcvarsall()') - except DistutilsPlatformError: + except distutils.errors.DistutilsPlatformError: exc_message = str(sys.exc_info()[1]) self.assertIn('aka.ms/vcpython27', exc_message) finally: -- cgit v1.2.1 From 57ff99e246a2fdb3d59e7aa977fe3b1e00924c99 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 18:38:39 -0400 Subject: Grab winreg module from distutils.msvc9compiler --- setuptools/tests/test_msvc9compiler.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 74b5220b..8f71c3d5 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -12,11 +12,6 @@ import tempfile import unittest import distutils.errors -try: - from winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE -except ImportError: - from _winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE - import distutils.msvc9compiler # importing only setuptools should apply the patch @@ -36,9 +31,12 @@ class MockReg: self.original_read_keys = distutils.msvc9compiler.Reg.read_keys self.original_read_values = distutils.msvc9compiler.Reg.read_values + _winreg = getattr(distutils.msvc9compiler, '_winreg', None) + winreg = getattr(distutils.msvc9compiler, 'winreg', _winreg) + hives = { - HKEY_CURRENT_USER: self.hkcu, - HKEY_LOCAL_MACHINE: self.hklm, + winreg.HKEY_CURRENT_USER: self.hkcu, + winreg.HKEY_LOCAL_MACHINE: self.hklm, } def read_keys(cls, base, key): -- cgit v1.2.1 From dfa59bff40dce47c485cdba1f28d1a8908e7e2be Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 18:47:55 -0400 Subject: Skip tests if msvc9compiler isn't available. --- setuptools/tests/test_msvc9compiler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 8f71c3d5..99afb10e 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -12,8 +12,6 @@ import tempfile import unittest import distutils.errors -import distutils.msvc9compiler - # importing only setuptools should apply the patch __import__('setuptools') @@ -63,6 +61,10 @@ class MockReg: class TestMSVC9Compiler(unittest.TestCase): def test_find_vcvarsall_patch(self): + if not hasattr(distutils, 'msvc9compiler'): + # skip + return + self.assertEqual( "setuptools.extension", distutils.msvc9compiler.find_vcvarsall.__module__, -- cgit v1.2.1 From 552e44fdce5a897f8e41efe07cf480759a59bb94 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 19:05:16 -0400 Subject: Extracting environment patcher --- setuptools/tests/test_msvc9compiler.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 99afb10e..80aac2f6 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -11,6 +11,7 @@ import sys import tempfile import unittest import distutils.errors +import contextlib # importing only setuptools should apply the patch __import__('setuptools') @@ -58,6 +59,25 @@ class MockReg: distutils.msvc9compiler.Reg.read_keys = self.original_read_keys distutils.msvc9compiler.Reg.read_values = self.original_read_values +@contextlib.contextmanager +def patch_env(**replacements): + saved = dict( + (key, os.environ['key']) + for key in replacements + if key in os.environ + ) + os.environ.update(replacements) + + # remove values that are null + null_keys = (key for (key, value) in replacements if value is None) + list(map(os.environ.pop, (null_keys))) + + yield + + for key in replacements: + os.environ.pop(key, None) + os.environ.update(saved) + class TestMSVC9Compiler(unittest.TestCase): def test_find_vcvarsall_patch(self): @@ -76,8 +96,7 @@ class TestMSVC9Compiler(unittest.TestCase): # No registry entries or environment variable means we should # not find anything - old_value = os.environ.pop("VS90COMNTOOLS", None) - try: + with patch_env(VS90COMNTOOLS=None): with MockReg(): self.assertIsNone(find_vcvarsall(9.0)) @@ -87,9 +106,6 @@ class TestMSVC9Compiler(unittest.TestCase): except distutils.errors.DistutilsPlatformError: exc_message = str(sys.exc_info()[1]) self.assertIn('aka.ms/vcpython27', exc_message) - finally: - if old_value: - os.environ["VS90COMNTOOLS"] = old_value key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir' key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir' -- cgit v1.2.1 From d501896d27cf94f62b80fe266d9369e681a32de6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 19:09:41 -0400 Subject: Correct test assertion --- setuptools/tests/test_msvc9compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 80aac2f6..02ced8cf 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -86,7 +86,7 @@ class TestMSVC9Compiler(unittest.TestCase): return self.assertEqual( - "setuptools.extension", + "setuptools.msvc9_support", distutils.msvc9compiler.find_vcvarsall.__module__, "find_vcvarsall was not patched" ) -- cgit v1.2.1 From 475e7c869bb60dba329a9642ff13bd10d1cbdced Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 19:11:04 -0400 Subject: Meant 'items' --- setuptools/tests/test_msvc9compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 02ced8cf..1c557d39 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -69,7 +69,7 @@ def patch_env(**replacements): os.environ.update(replacements) # remove values that are null - null_keys = (key for (key, value) in replacements if value is None) + null_keys = (key for (key, value) in replacements.items() if value is None) list(map(os.environ.pop, (null_keys))) yield -- cgit v1.2.1 From 813855aa5c9cb09c1e0faffcb80bfa2cb0cb2852 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 19:18:50 -0400 Subject: Avoid passing None values to os.environ. --- setuptools/tests/test_msvc9compiler.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 1c557d39..b2769759 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -66,13 +66,16 @@ def patch_env(**replacements): for key in replacements if key in os.environ ) - os.environ.update(replacements) # remove values that are null - null_keys = (key for (key, value) in replacements.items() if value is None) - list(map(os.environ.pop, (null_keys))) + remove = (key for (key, value) in replacements.items() if value is None) + for key in list(remove): + os.environ.pop(key, None) + replacements.pop(key) + + os.environ.update(replacements) - yield + yield saved for key in replacements: os.environ.pop(key, None) -- cgit v1.2.1 From 8759ca96ec6c6c318d65e0c93ca8b3c93f45e7f9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 19:20:32 -0400 Subject: Add docstring --- setuptools/tests/test_msvc9compiler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index b2769759..ac5e3914 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -61,6 +61,10 @@ class MockReg: @contextlib.contextmanager def patch_env(**replacements): + """ + In a context, patch the environment with replacements. Pass None values + to clear the values. + """ saved = dict( (key, os.environ['key']) for key in replacements -- cgit v1.2.1 From 46a65a1a635cf3986c853907d1a16c5173cc125d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 19:21:21 -0400 Subject: Always restore os.environ even if an exception occurs. --- setuptools/tests/test_msvc9compiler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index ac5e3914..970f7679 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -79,11 +79,12 @@ def patch_env(**replacements): os.environ.update(replacements) - yield saved - - for key in replacements: - os.environ.pop(key, None) - os.environ.update(saved) + try: + yield saved + finally: + for key in replacements: + os.environ.pop(key, None) + os.environ.update(saved) class TestMSVC9Compiler(unittest.TestCase): -- cgit v1.2.1 From b67548a1ed3c0f606846303041e46bca76b635b6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 02:08:19 -0400 Subject: Update changelog to reference documented issue. Fixes #258. --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index ab58bb14..59e63aad 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -29,7 +29,7 @@ CHANGES ordered deterministically. * Issue #118: The egg-info directory is now no longer included in the list of outputs. -* Pull Request #83: Setuptools now patches distutils msvc9compiler to +* Issue #258: Setuptools now patches distutils msvc9compiler to recognize the specially-packaged compiler package for easy extension module support on Python 2.6, 2.7, and 3.2. -- cgit v1.2.1 From 39f98548e30b5e333276994fcaea4e529be4e40c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 02:12:43 -0400 Subject: Bumped to 6.0 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 0fd1c872..f4a1aaec 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "5.9" +DEFAULT_VERSION = "6.0" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 7244139e..5fa6331d 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '5.9' +__version__ = '6.0' -- cgit v1.2.1 From 7caf6b91f8602fac8addbdcf5cb023b49d01e1f2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 02:12:46 -0400 Subject: Added tag 6.0 for changeset 755cbfd3743f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 17532221..dadf2238 100644 --- a/.hgtags +++ b/.hgtags @@ -154,3 +154,4 @@ ba3b08c7bffd6123e1a7d58994f15e8051a67cb7 5.4.1 a1fc0220bfa3581158688789f6dfdc00672eb99b 5.6 37ed55fd310d0cd32009dc5676121e86b404a23d 5.7 67550a8ed9f4ef49ee5a31f433adbf5a0eaeccf9 5.8 +755cbfd3743ffb186cdf7e20be8e61dbdaa22503 6.0 -- cgit v1.2.1 From bb37802dc9f5bcaff5418438a88877b521208932 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 02:13:23 -0400 Subject: Bumped to 6.1 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index f4a1aaec..a693849f 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "6.0" +DEFAULT_VERSION = "6.1" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 5fa6331d..2d3f6733 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '6.0' +__version__ = '6.1' -- cgit v1.2.1 From 89bde0f0a7af8936e38dbedbd82e2af14f3efc39 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 09:29:26 -0400 Subject: Add doctesting of modules. Ref #259. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bc387f46..b434a793 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,5 +11,5 @@ script: # testing fix for https://bitbucket.org/hpk42/pytest/issue/555 - pip install --pre -i https://devpi.net/hpk/dev/ --upgrade pytest - python setup.py test - - python setup.py ptr + - python setup.py ptr --addopts='--doctest-modules' - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From 5802fd80e413b63af8be9198f14da1ade47d409c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 09:29:53 -0400 Subject: Use rpartition here, essential to the algorithm. Fixes #259. --HG-- extra : amend_source : d7b3c001b4db616a67793dcc57d5c13e3828ad3a --- setuptools/command/install_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 3cd16a8f..9b772227 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -43,7 +43,7 @@ class install_lib(orig.install_lib): """ while pkg_name: yield pkg_name - pkg_name, sep, child = pkg_name.partition('.') + pkg_name, sep, child = pkg_name.rpartition('.') def _get_SVEM_NSPs(self): """ -- cgit v1.2.1 From 84a4f9e884d4d173c7b1dbf076dcfb1b0232b261 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 09:40:32 -0400 Subject: Update changelog --- CHANGES.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 59e63aad..419c3c2b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,13 @@ CHANGES ======= +----- +6.0.1 +----- + +* Issue #259: Fixed regression with namespace package handling on ``single + version, externally managed`` installs. + --- 6.0 --- -- cgit v1.2.1 From 977e98de5785333c945cd61e4e5878d4484fc4c9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 09:40:48 -0400 Subject: Bumped to 6.0.1 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index a693849f..e8157e49 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "6.1" +DEFAULT_VERSION = "6.0.1" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index 2d3f6733..c4b0ef89 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '6.1' +__version__ = '6.0.1' -- cgit v1.2.1 From 3fb5d0ea96856387fc36603bc3a4d5b5fee2597c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 09:40:51 -0400 Subject: Added tag 6.0.1 for changeset bc6655b4acf2 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dadf2238..ff59322b 100644 --- a/.hgtags +++ b/.hgtags @@ -155,3 +155,4 @@ a1fc0220bfa3581158688789f6dfdc00672eb99b 5.6 37ed55fd310d0cd32009dc5676121e86b404a23d 5.7 67550a8ed9f4ef49ee5a31f433adbf5a0eaeccf9 5.8 755cbfd3743ffb186cdf7e20be8e61dbdaa22503 6.0 +bc6655b4acf205dd9f25c702955645656077398a 6.0.1 -- cgit v1.2.1 From b08527744e3f6cec0412a5de5cae9837e403061a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 09:41:26 -0400 Subject: Bumped to 6.0.2 in preparation for next release. --- ez_setup.py | 2 +- setuptools/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index e8157e49..c5d85d37 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -36,7 +36,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "6.0.1" +DEFAULT_VERSION = "6.0.2" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" def _python_cmd(*args): diff --git a/setuptools/version.py b/setuptools/version.py index c4b0ef89..c974945d 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '6.0.1' +__version__ = '6.0.2' -- cgit v1.2.1 From 60b97b0ca2335907fea90a904fcabedc44a47886 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 11:21:57 -0400 Subject: Try ignoring release.py --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b434a793..b2ebcf1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,5 +11,5 @@ script: # testing fix for https://bitbucket.org/hpk42/pytest/issue/555 - pip install --pre -i https://devpi.net/hpk/dev/ --upgrade pytest - python setup.py test - - python setup.py ptr --addopts='--doctest-modules' + - python setup.py ptr --addopts='--doctest-modules --ignore release.py' - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From a40ae765974198e88337627123d97f9fc45a2e4b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 11:26:29 -0400 Subject: Also ignore lib2to3_ex.py --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b2ebcf1e..b9690538 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,5 +11,6 @@ script: # testing fix for https://bitbucket.org/hpk42/pytest/issue/555 - pip install --pre -i https://devpi.net/hpk/dev/ --upgrade pytest - python setup.py test - - python setup.py ptr --addopts='--doctest-modules --ignore release.py' + - python setup.py ptr --addopts='--doctest-modules --ignore release.py + --ignore setuptools/lib2to3_ex.py' - python ez_setup.py --version 5.4.1 -- cgit v1.2.1 From 2b5d7f1333ff860bc9210ab3ad9ab2791db12bc2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Sep 2014 14:56:52 -0400 Subject: Move doctest directive and ignores to setup.cfg --- .travis.yml | 3 +-- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9690538..bc387f46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,5 @@ script: # testing fix for https://bitbucket.org/hpk42/pytest/issue/555 - pip install --pre -i https://devpi.net/hpk/dev/ --upgrade pytest - python setup.py test - - python setup.py ptr --addopts='--doctest-modules --ignore release.py - --ignore setuptools/lib2to3_ex.py' + - python setup.py ptr - python ez_setup.py --version 5.4.1 diff --git a/setup.cfg b/setup.cfg index 7f5fc796..74a172a4 100755 --- a/setup.cfg +++ b/setup.cfg @@ -21,5 +21,5 @@ formats = gztar zip universal=1 [pytest] -addopts=--ignore tests/manual_test.py --ignore tests/shlib_test +addopts=--doctest-modules --ignore release.py --ignore setuptools/lib2to3_ex.py --ignore tests/manual_test.py --ignore tests/shlib_test norecursedirs=dist build *.egg -- cgit v1.2.1 From 946652ee4def4236696a00d8873186bb07f15c71 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 29 Sep 2014 08:38:08 -0400 Subject: Backout 5692cd26a08e; Ref #262. --- setuptools/command/install_egg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py index 992709f1..fd0f118b 100755 --- a/setuptools/command/install_egg_info.py +++ b/setuptools/command/install_egg_info.py @@ -27,7 +27,7 @@ class install_egg_info(Command): ).egg_name() + '.egg-info' self.source = ei_cmd.egg_info self.target = os.path.join(self.install_dir, basename) - self.outputs = [] + self.outputs = [self.target] def run(self): self.run_command('egg_info') -- cgit v1.2.1 From 2024eed40b8168372becc15e5c9c6f6125327af6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 29 Sep 2014 08:38:24 -0400 Subject: Added tag 6.0.2b1 for changeset 1ae2a75724bb --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index ff59322b..a2912f64 100644 --- a/.hgtags +++ b/.hgtags @@ -156,3 +156,4 @@ a1fc0220bfa3581158688789f6dfdc00672eb99b 5.6 67550a8ed9f4ef49ee5a31f433adbf5a0eaeccf9 5.8 755cbfd3743ffb186cdf7e20be8e61dbdaa22503 6.0 bc6655b4acf205dd9f25c702955645656077398a 6.0.1 +1ae2a75724bbba56373784f185a7f235ed0f24a4 6.0.2b1 -- cgit v1.2.1 From 9e7f35fec4178dea678693cb768b6076d45e7ddd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 29 Sep 2014 11:40:57 -0400 Subject: Update changelog. Fixes #262. Re-opens #118. --- CHANGES.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 419c3c2b..0f5e56f4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,13 @@ CHANGES ======= +----- +6.0.2 +----- + +* Issue #262: Fixed regression in pip install due to egg-info directories + being omitted. Re-opens Issue #118. + ----- 6.0.1 ----- -- cgit v1.2.1