From 67f0cc59f0d803f13c1da1cb60e87469f656617e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 10 Jul 2020 20:14:49 -0400 Subject: Provide escape hatch for distutils adoption. --- setuptools/distutils_patch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3