diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-10 20:46:30 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-11 02:09:01 -0400 |
commit | bedaf1309d2633831a7fb7dea561642e7da704df (patch) | |
tree | 866cc2ddac5a86e0686e62195c22fbaaeb1e98ec | |
parent | 67f0cc59f0d803f13c1da1cb60e87469f656617e (diff) | |
download | python-setuptools-git-distutils-adopt-escape-hatch.tar.gz |
Allow opt-in and opt-out of distutils adoption at run time with SETUPTOOLS_USE_DISTUTILS environment variable.distutils-adopt-escape-hatch
-rw-r--r-- | changelog.d/2232.misc.patch | 1 | ||||
-rw-r--r-- | setuptools/__init__.py | 2 | ||||
-rw-r--r-- | setuptools/distutils_patch.py | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/changelog.d/2232.misc.patch b/changelog.d/2232.misc.patch new file mode 100644 index 00000000..4a956e1e --- /dev/null +++ b/changelog.d/2232.misc.patch @@ -0,0 +1 @@ +In preparation for re-enabling a local copy of distutils, Setuptools now honors an environment variable, SETUPTOOLS_USE_DISTUTILS. If set to 'stdlib' (current default), distutils will be used from the standard library. If set to 'local' (default in a imminent backward-incompatible release), the local copy of distutils will be used. 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 bd1b4997..c5f273dd 100644 --- a/setuptools/distutils_patch.py +++ b/setuptools/distutils_patch.py @@ -23,9 +23,10 @@ def clear_distutils(): def enabled(): """ - Provide an escape hatch for environments wishing to opt out. + Allow selection of distutils by environment variable. """ - return 'SETUPTOOLS_DISTUTILS_ADOPTION_OPT_OUT' not in os.environ + which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') + return which == 'local' def ensure_local_distutils(): |