Commit 474e9044 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #2159 from pypa/bugfix/2158-defer-finalize-options

Defer finalize options
parents 1988125e 2dc4b62d
Avoid loading working set during ``Distribution.finalize_options`` prior to invoking ``_install_setup_requires``, broken since v42.0.0.
...@@ -129,10 +129,27 @@ if PY3: ...@@ -129,10 +129,27 @@ if PY3:
def _install_setup_requires(attrs): def _install_setup_requires(attrs):
# Note: do not use `setuptools.Distribution` directly, as # Note: do not use `setuptools.Distribution` directly, as
# our PEP 517 backend patch `distutils.core.Distribution`. # our PEP 517 backend patch `distutils.core.Distribution`.
dist = distutils.core.Distribution(dict( class MinimalDistribution(distutils.core.Distribution):
(k, v) for k, v in attrs.items() """
if k in ('dependency_links', 'setup_requires') 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. # Honor setup.cfg's options.
dist.parse_config_files(ignore_option_errors=True) dist.parse_config_files(ignore_option_errors=True)
if dist.setup_requires: if dist.setup_requires:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment