diff options
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() |
