diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-28 21:00:11 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-28 21:00:11 -0400 |
| commit | 474e90443708a4042ca21ac7a8221896ba5076a2 (patch) | |
| tree | 0cafa31c6b1ad68fd737c7a1a47419629a4608c3 | |
| parent | 1988125e800b3b64f9cf9311fea5525cc81546f9 (diff) | |
| parent | 2dc4b62da3d32bd765686d62c8ce5ec69b96ff92 (diff) | |
| download | external_python_setuptools-474e90443708a4042ca21ac7a8221896ba5076a2.tar.gz external_python_setuptools-474e90443708a4042ca21ac7a8221896ba5076a2.tar.bz2 external_python_setuptools-474e90443708a4042ca21ac7a8221896ba5076a2.zip | |
Merge pull request #2159 from pypa/bugfix/2158-defer-finalize-options
Defer finalize options
| -rw-r--r-- | changelog.d/2158.misc.rst | 1 | ||||
| -rw-r--r-- | setuptools/__init__.py | 25 |
2 files changed, 22 insertions, 4 deletions
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. 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: |
