Imported Upstream version 41.0.1 upstream/41.0.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Dec 2020 22:04:06 +0000 (07:04 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Dec 2020 22:04:06 +0000 (07:04 +0900)
.bumpversion.cfg
.travis.yml
CHANGES.rst
setup.cfg
setuptools/build_meta.py
setuptools/command/test.py
setuptools/package_index.py
setuptools/py31compat.py
setuptools/tests/test_build_meta.py
setuptools/tests/test_packageindex.py

index a8fd179a8080bdb6d4887e92cf293bfecaf34745..87acb5ef8d55ccc0615c68ca06b529d3f3d81f27 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 41.0.0
+current_version = 41.0.1
 commit = True
 tag = True
 
index a5b670e4b994b07f601aed2dd571a1aa27b09cf1..ffcad99864915a6eb5480334617f1814cfba277d 100644 (file)
@@ -1,4 +1,4 @@
-dist: trusty
+dist: xenial
 language: python
 
 jobs:
@@ -9,9 +9,8 @@ jobs:
   - <<: *latest_py2
     env: LANG=C
   - python: pypy2.7-6.0.0
-    dist: xenial
     env: DISABLE_COVERAGE=1  # Don't run coverage on pypy (too slow).
-  - python: pypy3
+  - python: pypy3.5-6.0.0
     env: DISABLE_COVERAGE=1
   - python: 3.4
   - python: 3.5
@@ -19,12 +18,9 @@ jobs:
     python: 3.6
   - &latest_py3
     python: 3.7
-    dist: xenial
   - <<: *latest_py3
     env: LANG=C
   - python: 3.8-dev
-    dist: xenial
-    env: DISABLE_COVERAGE=1  # Ignore invalid coverage data.
   - <<: *default_py
     stage: deploy (to PyPI for tagged commits)
     if: tag IS present
index 8785d3d26972128d0503498bfd949f32f47686dd..9da2253792ccc97e40c721318ba78e37b4010bed 100644 (file)
@@ -1,3 +1,11 @@
+v41.0.1
+-------
+
+* #1671: Fixed issue with the PEP 517 backend that prevented building a wheel when the ``dist/`` directory contained existing ``.whl`` files.
+* #1709: In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH.
+* #1741: In package_index, now honor "current directory" during a checkout of git and hg repositories under Windows
+
+
 v41.0.0
 -------
 
@@ -1496,8 +1504,8 @@ v20.6.0
 19.7
 ----
 
-* `Off-project PR <https://github.com/jaraco/setuptools/pull/32>`_:
-  For FreeBSD, also honor root certificates from ca_root_nss.
+* Off-project PR: `0dcee79 <https://github.com/pypa/setuptools/commit/0dcee791dfdcfacddaaec79b29f30a347a147413>`_ and `f9bd9b9 <https://github.com/pypa/setuptools/commit/f9bd9b9f5df54ef5a0bf8d16c3a889ab8c640580>`_
+  For FreeBSD, also `honor root certificates from ca_root_nss <https://github.com/pypa/setuptools/commit/3ae46c30225eb46e1f5aada1a19e88b79f04dc72>`_.
 
 19.6.2
 ------
@@ -1661,9 +1669,9 @@ v20.6.0
   now logged when pkg_resources is imported on Python 3.2 or earlier
   Python 3 versions.
 * `Add support for python_platform_implementation environment marker
-  <https://github.com/jaraco/setuptools/pull/28>`_.
+  <https://github.com/pypa/setuptools/commit/94416707fd59a65f4a8f7f70541d6b3fc018b626>`_.
 * `Fix dictionary mutation during iteration
-  <https://github.com/jaraco/setuptools/pull/29>`_.
+  <https://github.com/pypa/setuptools/commit/57ebfa41e0f96b97e599ecd931b7ae8a143e096e>`_.
 
 18.4
 ----
@@ -2023,7 +2031,7 @@ process to fail and PyPI uploads no longer accept files for 13.0.
 ---
 
 * Prefer vendored packaging library `as recommended
-  <https://github.com/jaraco/setuptools/commit/170657b68f4b92e7e1bf82f5e19a831f5744af67#commitcomment-9109448>`_.
+  <https://github.com/pypa/setuptools/commit/170657b68f4b92e7e1bf82f5e19a831f5744af67>`_.
 
 9.0.1
 -----
index 561e7b248eab7687c5912a5ed6cc01bb6f3add0f..3945408162b5894f0aed973e8d7380ab40422411 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -19,4 +19,4 @@ universal = 1
 
 [metadata]
 license_file = LICENSE
-version = 41.0.0
+version = 41.0.1
index 47cbcbf68434babafc9ec98cf5c4f476540c0dee..e40904a5dfdcf60d73df7d68c3cccaa64f8d2076 100644 (file)
@@ -35,6 +35,7 @@ import contextlib
 
 import setuptools
 import distutils
+from setuptools.py31compat import TemporaryDirectory
 
 from pkg_resources import parse_requirements
 
@@ -182,14 +183,22 @@ class _BuildMetaBackend(object):
                     metadata_directory=None):
         config_settings = self._fix_config(config_settings)
         wheel_directory = os.path.abspath(wheel_directory)
-        sys.argv = sys.argv[:1] + ['bdist_wheel'] + \
-            config_settings["--global-option"]
-        self.run_setup()
-        if wheel_directory != 'dist':
-            shutil.rmtree(wheel_directory)
-            shutil.copytree('dist', wheel_directory)
 
-        return _file_with_extension(wheel_directory, '.whl')
+        # Build the wheel in a temporary directory, then copy to the target
+        with TemporaryDirectory(dir=wheel_directory) as tmp_dist_dir:
+            sys.argv = (sys.argv[:1] +
+                        ['bdist_wheel', '--dist-dir', tmp_dist_dir] +
+                        config_settings["--global-option"])
+            self.run_setup()
+
+            wheel_basename = _file_with_extension(tmp_dist_dir, '.whl')
+            wheel_path = os.path.join(wheel_directory, wheel_basename)
+            if os.path.exists(wheel_path):
+                # os.rename will fail overwriting on non-unix env
+                os.remove(wheel_path)
+            os.rename(os.path.join(tmp_dist_dir, wheel_basename), wheel_path)
+
+        return wheel_basename
 
     def build_sdist(self, sdist_directory, config_settings=None):
         config_settings = self._fix_config(config_settings)
index dde0118c905bf32313e11c21b827767390d5beb6..973e4eb214b1305aadf771617b2b4ec162feea1f 100644 (file)
@@ -15,6 +15,7 @@ from pkg_resources import (resource_listdir, resource_exists, normalize_path,
                            working_set, _namespace_packages, evaluate_marker,
                            add_activation_listener, require, EntryPoint)
 from setuptools import Command
+from .build_py import _unique_everseen
 
 __metaclass__ = type
 
@@ -186,7 +187,7 @@ class test(Command):
         orig_pythonpath = os.environ.get('PYTHONPATH', nothing)
         current_pythonpath = os.environ.get('PYTHONPATH', '')
         try:
-            prefix = os.pathsep.join(paths)
+            prefix = os.pathsep.join(_unique_everseen(paths))
             to_join = filter(None, [prefix, current_pythonpath])
             new_path = os.pathsep.join(to_join)
             if new_path:
index 705a47cf80d3c385d4c8a848b8662c0a69377e71..6b06f2ca281296c989fa55c6c77c9d8b7356b552 100644 (file)
@@ -897,7 +897,7 @@ class PackageIndex(Environment):
 
         if rev is not None:
             self.info("Checking out %s", rev)
-            os.system("(cd %s && git checkout --quiet %s)" % (
+            os.system("git -C %s checkout --quiet %s" % (
                 filename,
                 rev,
             ))
@@ -913,7 +913,7 @@ class PackageIndex(Environment):
 
         if rev is not None:
             self.info("Updating to %s", rev)
-            os.system("(cd %s && hg up -C -r %s -q)" % (
+            os.system("hg --cwd %s up -C -r %s -q" % (
                 filename,
                 rev,
             ))
index 1a0705ece35b718a98bbb89c1ba35cbf0ff255dc..e1da7ee2a2c56e46e09665d98ba1bc5bfedd2c3e 100644 (file)
@@ -17,9 +17,9 @@ except ImportError:
         errors on deletion.
         """
 
-        def __init__(self):
+        def __init__(self, **kwargs):
             self.name = None  # Handle mkdtemp raising an exception
-            self.name = tempfile.mkdtemp()
+            self.name = tempfile.mkdtemp(**kwargs)
 
         def __enter__(self):
             return self.name
index 0bdea2d613b2133a9989c9e7ad7e33a77a71776a..7612ebd7fc4f85d5caad79afe603fcfb14d2c973 100644 (file)
@@ -28,7 +28,7 @@ class BuildBackend(BuildBackendBase):
 
     def __init__(self, *args, **kwargs):
         super(BuildBackend, self).__init__(*args, **kwargs)
-        self.pool = futures.ProcessPoolExecutor()
+        self.pool = futures.ProcessPoolExecutor(max_workers=1)
 
     def __getattr__(self, name):
         """Handles aribrary function invocations on the build backend."""
@@ -157,6 +157,49 @@ class TestBuildMetaBackend:
 
         assert os.path.isfile(os.path.join(dist_dir, wheel_name))
 
+    def test_build_wheel_with_existing_wheel_file_present(self, tmpdir_cwd):
+        # Building a wheel should still succeed if there's already a wheel
+        # in the wheel directory
+        files = {
+            'setup.py': "from setuptools import setup\nsetup()",
+            'VERSION': "0.0.1",
+            'setup.cfg': DALS("""
+                [metadata]
+                name = foo
+                version = file: VERSION
+            """),
+            'pyproject.toml': DALS("""
+                [build-system]
+                requires = ["setuptools", "wheel"]
+                build-backend = "setuptools.build_meta
+            """),
+        }
+
+        build_files(files)
+
+        dist_dir = os.path.abspath('pip-wheel-preexisting')
+        os.makedirs(dist_dir)
+
+        # make first wheel
+        build_backend = self.get_build_backend()
+        wheel_one = build_backend.build_wheel(dist_dir)
+
+        # change version
+        with open("VERSION", "wt") as version_file:
+            version_file.write("0.0.2")
+
+        # make *second* wheel
+        wheel_two = self.get_build_backend().build_wheel(dist_dir)
+
+        assert os.path.isfile(os.path.join(dist_dir, wheel_one))
+        assert wheel_one != wheel_two
+
+        # and if rebuilding the same wheel?
+        open(os.path.join(dist_dir, wheel_two), 'w').close()
+        wheel_three = self.get_build_backend().build_wheel(dist_dir)
+        assert wheel_three == wheel_two
+        assert os.path.getsize(os.path.join(dist_dir, wheel_three)) > 0
+
     def test_build_sdist(self, build_backend):
         dist_dir = os.path.abspath('pip-sdist')
         os.makedirs(dist_dir)
index ab371884d9a8ea9447fc57c558997450037bccac..60d968fdfac498bcf95df4b698f8b3e9f27f8fd1 100644 (file)
@@ -249,7 +249,7 @@ class TestPackageIndex:
         first_call_args = os_system_mock.call_args_list[0][0]
         assert first_call_args == (expected,)
 
-        tmpl = '(cd {expected_dir} && git checkout --quiet master)'
+        tmpl = 'git -C {expected_dir} checkout --quiet master'
         expected = tmpl.format(**locals())
         assert os_system_mock.call_args_list[1][0] == (expected,)
         assert result == expected_dir