diff options
| -rw-r--r-- | _distutils_hack/__init__.py | 7 | ||||
| -rw-r--r-- | changelog.d/2980.misc.rst | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 85a51370..55ea0825 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -86,6 +86,13 @@ class DistutilsMetaFinder: import importlib.abc import importlib.util + # In cases of path manipulation during sitecustomize, + # Setuptools might actually not be present even though + # the hook has been loaded. Allow the caller to fall + # back to stdlib behavior. See #2980. + if not importlib.util.find_spec('setuptools'): + return + class DistutilsLoader(importlib.abc.Loader): def create_module(self, spec): diff --git a/changelog.d/2980.misc.rst b/changelog.d/2980.misc.rst new file mode 100644 index 00000000..222a3adb --- /dev/null +++ b/changelog.d/2980.misc.rst @@ -0,0 +1 @@ +Bypass distutils loader when setuptools module is no longer available on sys.path. |
