diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-11 02:16:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-11 02:16:44 -0400 |
| commit | dc4fcfd23750e28a02123eb50e174f430c2e6234 (patch) | |
| tree | 866cc2ddac5a86e0686e62195c22fbaaeb1e98ec /setuptools | |
| parent | cd8ac41d2f40de096251b78a55a74b2705a7af8f (diff) | |
| parent | bedaf1309d2633831a7fb7dea561642e7da704df (diff) | |
| download | python-setuptools-git-dc4fcfd23750e28a02123eb50e174f430c2e6234.tar.gz | |
Merge pull request #2247 from pypa/distutils-adopt-escape-hatch
Re-enable distutils adoption with escape hatch
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/__init__.py | 2 | ||||
| -rw-r--r-- | setuptools/distutils_patch.py | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index a6cbe132..83882511 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -4,7 +4,7 @@ import os import functools # Disabled for now due to: #2228, #2230 -# import setuptools.distutils_patch # noqa: F401 +import setuptools.distutils_patch # noqa: F401 import distutils.core import distutils.filelist diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py index b2095fba..c5f273dd 100644 --- a/setuptools/distutils_patch.py +++ b/setuptools/distutils_patch.py @@ -7,6 +7,7 @@ for more motivation. import sys import re +import os import importlib import warnings @@ -20,6 +21,14 @@ def clear_distutils(): del sys.modules[name] +def enabled(): + """ + Allow selection of distutils by environment variable. + """ + which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') + return which == 'local' + + def ensure_local_distutils(): clear_distutils() distutils = importlib.import_module('setuptools._distutils') @@ -31,4 +40,5 @@ def ensure_local_distutils(): assert '_distutils' in core.__file__, core.__file__ -ensure_local_distutils() +if enabled(): + ensure_local_distutils() |
