From 4020c9a5fe3c30e1192412786ce299dd8a909266 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 28 May 2020 20:04:58 -0400 Subject: Avoid loading working set during `Distribution.finalize_options` prior to invoking `_install_setup_requires`, broken since v42.0.0. Fixes #2158. --- setuptools/__init__.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/setuptools/__init__.py b/setuptools/__init__.py index a71b2bbd..9d8ae1ed 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -129,10 +129,27 @@ if PY3: def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. - dist = distutils.core.Distribution(dict( - (k, v) for k, v in attrs.items() - if k in ('dependency_links', 'setup_requires') - )) + class MinimalDistribution(distutils.core.Distribution): + """ + A minimal version of a distribution for supporting the + fetch_build_eggs interface. + """ + def __init__(self, attrs): + _incl = 'dependency_links', 'setup_requires' + filtered = { + k: attrs[k] + for k in set(_incl) & set(attrs) + } + distutils.core.Distribution.__init__(self, filtered) + + def finalize_options(self): + """ + Disable finalize_options to avoid building the working set. + Ref #2158. + """ + + dist = MinimalDistribution(attrs) + # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: -- cgit v1.2.3 From 2dc4b62da3d32bd765686d62c8ce5ec69b96ff92 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 28 May 2020 20:05:26 -0400 Subject: Update changelog. --- changelog.d/2158.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2158.misc.rst diff --git a/changelog.d/2158.misc.rst b/changelog.d/2158.misc.rst new file mode 100644 index 00000000..16a5a504 --- /dev/null +++ b/changelog.d/2158.misc.rst @@ -0,0 +1 @@ +Avoid loading working set during ``Distribution.finalize_options`` prior to invoking ``_install_setup_requires``, broken since v42.0.0. -- cgit v1.2.3 From df51e62984850e58e8f29e8223b714091e0b8a5b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 28 May 2020 21:00:39 -0400 Subject: =?UTF-8?q?Bump=20version:=2044.1.0=20=E2=86=92=2044.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ changelog.d/2158.misc.rst | 1 - setup.cfg | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2158.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c8c9f544..4bea6cca 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 44.1.0 +current_version = 44.1.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 83cd8c78..43b65eb3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v44.1.1 +------- + +* #2158: Avoid loading working set during ``Distribution.finalize_options`` prior to invoking ``_install_setup_requires``, broken since v42.0.0. + + v44.1.0 ------- diff --git a/changelog.d/2158.misc.rst b/changelog.d/2158.misc.rst deleted file mode 100644 index 16a5a504..00000000 --- a/changelog.d/2158.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Avoid loading working set during ``Distribution.finalize_options`` prior to invoking ``_install_setup_requires``, broken since v42.0.0. diff --git a/setup.cfg b/setup.cfg index cb5ae73b..323d2cf5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ universal = 1 [metadata] name = setuptools -version = 44.1.0 +version = 44.1.1 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org -- cgit v1.2.3