diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-01-02 22:59:50 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-01-02 22:59:50 -0500 |
commit | 41fa663c9da93ca1af98ce2ae397c02e4b3062e8 (patch) | |
tree | 222a9a59f98529a7c1c48f270c9f68ca7bc34985 | |
parent | 80045ce11c74d1b50892d15feef82415e6badfe9 (diff) | |
download | python-setuptools-git-bugfix/2993-get-pip-exemption.tar.gz |
Add another exception for the exclusion for pip. Fixes #2993.bugfix/2993-get-pip-exemption
-rw-r--r-- | _distutils_hack/__init__.py | 10 | ||||
-rw-r--r-- | changelog.d/2993.change.rst | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index c0170d09..4745f8b9 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -116,6 +116,8 @@ class DistutilsMetaFinder: """ if self.pip_imported_during_build(): return + if self.is_get_pip(): + return clear_distutils() self.spec_for_distutils = lambda: None @@ -130,6 +132,14 @@ class DistutilsMetaFinder: for frame, line in traceback.walk_stack(None) ) + @classmethod + def is_get_pip(cls): + """ + Detect if get-pip is being invoked. Ref #2993. + """ + import __main__ + return os.path.basename(__main__.__file__) == 'get-pip.py' + @staticmethod def frame_file_is_setup(frame): """ diff --git a/changelog.d/2993.change.rst b/changelog.d/2993.change.rst new file mode 100644 index 00000000..cd528d57 --- /dev/null +++ b/changelog.d/2993.change.rst @@ -0,0 +1 @@ +In _distutils_hack, bypass the distutils exception for pip when get-pip is being invoked, because it imports setuptools. |