diff options
| -rw-r--r-- | CHANGES.rst | 6 | ||||
| -rw-r--r-- | setuptools/__init__.py | 25 |
2 files changed, 27 insertions, 4 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index dbade950..048fef6b 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. + + v47.1.0 ------- diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 811f3fd2..833e20ea 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -128,10 +128,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: |
