diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-10 20:14:49 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-10 20:14:49 -0400 |
| commit | 67f0cc59f0d803f13c1da1cb60e87469f656617e (patch) | |
| tree | 2727dcf8965a543cdcbe28b75f45422841996d3a /setuptools/distutils_patch.py | |
| parent | cd8ac41d2f40de096251b78a55a74b2705a7af8f (diff) | |
| download | python-setuptools-git-67f0cc59f0d803f13c1da1cb60e87469f656617e.tar.gz | |
Provide escape hatch for distutils adoption.
Diffstat (limited to 'setuptools/distutils_patch.py')
| -rw-r--r-- | setuptools/distutils_patch.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py index b2095fba..bd1b4997 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,13 @@ def clear_distutils(): del sys.modules[name] +def enabled(): + """ + Provide an escape hatch for environments wishing to opt out. + """ + return 'SETUPTOOLS_DISTUTILS_ADOPTION_OPT_OUT' not in os.environ + + def ensure_local_distutils(): clear_distutils() distutils = importlib.import_module('setuptools._distutils') @@ -31,4 +39,5 @@ def ensure_local_distutils(): assert '_distutils' in core.__file__, core.__file__ -ensure_local_distutils() +if enabled(): + ensure_local_distutils() |
