Skip to content

Commit bedaf13

Browse files
committed
Allow opt-in and opt-out of distutils adoption at run time with SETUPTOOLS_USE_DISTUTILS environment variable.
1 parent 67f0cc5 commit bedaf13

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

changelog.d/2232.misc.patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

setuptools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import functools
55

66
# Disabled for now due to: #2228, #2230
7-
# import setuptools.distutils_patch # noqa: F401
7+
import setuptools.distutils_patch # noqa: F401
88

99
import distutils.core
1010
import distutils.filelist

setuptools/distutils_patch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ def clear_distutils():
2323

2424
def enabled():
2525
"""
26-
Provide an escape hatch for environments wishing to opt out.
26+
Allow selection of distutils by environment variable.
2727
"""
28-
return 'SETUPTOOLS_DISTUTILS_ADOPTION_OPT_OUT' not in os.environ
28+
which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib')
29+
return which == 'local'
2930

3031

3132
def ensure_local_distutils():

0 commit comments

Comments
 (0)