summaryrefslogtreecommitdiff
path: root/_distutils_hack/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to '_distutils_hack/__init__.py')
-rw-r--r--_distutils_hack/__init__.py7
1 files changed, 7 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):