From 41fa663c9da93ca1af98ce2ae397c02e4b3062e8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Jan 2022 22:59:50 -0500 Subject: Add another exception for the exclusion for pip. Fixes #2993. --- _distutils_hack/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '_distutils_hack/__init__.py') 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): """ -- cgit v1.2.1