Add another exception for the exclusion for pip. Fixes #2993.
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index c0170d0..4745f8b 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py
@@ -116,6 +116,8 @@ """ 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 @@ 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 0000000..cd528d5 --- /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.