summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-07-24 11:48:15 -0400
committerJason R. Coombs <jaraco@jaraco.com>2022-07-24 13:03:44 -0400
commit36659e9be8794631d721d459cdd8463366e7179a (patch)
tree7ea5aff39e736e5b95e345a231561cf42856af3f
parentab10c2234c4cce6061f673341e24f2d3e45acf32 (diff)
downloadpython-setuptools-git-feature/remove-distutils-hack-pip-workaround.tar.gz
Remove pip workaround in _distutils_hack.feature/remove-distutils-hack-pip-workaround
-rw-r--r--_distutils_hack/__init__.py35
-rw-r--r--changelog.d/3460.change.rst2
2 files changed, 1 insertions, 36 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py
index 24310637..64e24bea 100644
--- a/_distutils_hack/__init__.py
+++ b/_distutils_hack/__init__.py
@@ -137,41 +137,6 @@ class DistutilsMetaFinder:
"""
return os.path.isfile('pybuilddir.txt')
- def spec_for_pip(self):
- """
- Ensure stdlib distutils when running under pip.
- See pypa/pip#8761 for rationale.
-
- In pypa/pip#11298, pip added its own workaround, obviating
- the need for this one. After 2023-02-01, remove this workaround.
- """
- # late versions of pip no longer have this issue on Python 3.10+
- if sys.version_info > (3, 10):
- return
- if self.pip_imported_during_build():
- return
- clear_distutils()
- self.spec_for_distutils = lambda: None
-
- @classmethod
- def pip_imported_during_build(cls):
- """
- Detect if pip is being imported in a build script. Ref #2355.
- """
- import traceback
-
- return any(
- cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None)
- )
-
- @staticmethod
- def frame_file_is_setup(frame):
- """
- Return True if the indicated frame suggests a setup.py file.
- """
- # some frames may not have __file__ (#2940)
- return frame.f_globals.get('__file__', '').endswith('setup.py')
-
def spec_for_sensitive_tests(self):
"""
Ensure stdlib distutils when running select tests under CPython.
diff --git a/changelog.d/3460.change.rst b/changelog.d/3460.change.rst
index 129e909c..bcd8c5fb 100644
--- a/changelog.d/3460.change.rst
+++ b/changelog.d/3460.change.rst
@@ -1 +1 @@
-Limit the scope of the _distutils_hack workaround for pip.
+Remove the pip workaround in _distutils_hack.