aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_distutils_hack/__init__.py2
-rw-r--r--changelog.d/2232.breaking.rst1
-rwxr-xr-xsetup.py3
3 files changed, 4 insertions, 2 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py
index 71fa7ce1..e2adabd8 100644
--- a/_distutils_hack/__init__.py
+++ b/_distutils_hack/__init__.py
@@ -34,7 +34,7 @@ def enabled():
"""
Allow selection of distutils by environment variable.
"""
- which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib')
+ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local')
return which == 'local'
diff --git a/changelog.d/2232.breaking.rst b/changelog.d/2232.breaking.rst
new file mode 100644
index 00000000..b2fd926f
--- /dev/null
+++ b/changelog.d/2232.breaking.rst
@@ -0,0 +1 @@
+Once again, Setuptools overrides the stdlib distutils on import. For environments or invocations where this behavior is undesirable, users are provided with a temporary escape hatch. If the environment variable ``SETUPTOOLS_USE_DISTUTILS`` is set to ``stdlib``, Setuptools will fall back to the legacy behavior. Use of this escape hatch is discouraged, but it is provided to ease the transition while proper fixes for edge cases can be addressed.
diff --git a/setup.py b/setup.py
index 5d98c029..34654e19 100755
--- a/setup.py
+++ b/setup.py
@@ -99,7 +99,8 @@ class install_with_pth(install):
_pth_name = 'distutils-precedence'
_pth_contents = textwrap.dedent("""
import os
- enabled = os.environ.get('SETUPTOOLS_USE_DISTUTILS') == 'local'
+ var = 'SETUPTOOLS_USE_DISTUTILS'
+ enabled = os.environ.get(var, 'local') == 'local'
enabled and __import__('_distutils_hack').add_shim()
""").lstrip().replace('\n', '; ')