From: DongHun Kwak Date: Tue, 29 Dec 2020 22:04:06 +0000 (+0900) Subject: Imported Upstream version 41.0.1 X-Git-Tag: upstream/41.0.1^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ac2f3d9527ad1d1c1804eb6798a7bbe2cf19288;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 41.0.1 --- diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a8fd179..87acb5e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 41.0.0 +current_version = 41.0.1 commit = True tag = True diff --git a/.travis.yml b/.travis.yml index a5b670e..ffcad99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGES.rst b/CHANGES.rst index 8785d3d..9da2253 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 `_: - For FreeBSD, also honor root certificates from ca_root_nss. +* Off-project PR: `0dcee79 `_ and `f9bd9b9 `_ + For FreeBSD, also `honor root certificates from ca_root_nss `_. 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 - `_. + `_. * `Fix dictionary mutation during iteration - `_. + `_. 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 - `_. + `_. 9.0.1 ----- diff --git a/setup.cfg b/setup.cfg index 561e7b2..3945408 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,4 +19,4 @@ universal = 1 [metadata] license_file = LICENSE -version = 41.0.0 +version = 41.0.1 diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index 47cbcbf..e40904a 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -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) diff --git a/setuptools/command/test.py b/setuptools/command/test.py index dde0118..973e4eb 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -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: diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 705a47c..6b06f2c 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -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, )) diff --git a/setuptools/py31compat.py b/setuptools/py31compat.py index 1a0705e..e1da7ee 100644 --- a/setuptools/py31compat.py +++ b/setuptools/py31compat.py @@ -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 diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 0bdea2d..7612ebd 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -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) diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index ab37188..60d968f 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -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