diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-02-11 11:00:51 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-02-11 11:00:51 -0500 |
commit | 8cc7afb7ee85940978c249c8614198a7f18ada8a (patch) | |
tree | e40128c4104cfcd20ad348ff3dc6cdb36d90d60d | |
parent | f38d13906be5f3cfe3dadc0333c5ef01badaf777 (diff) | |
download | python-setuptools-git-bugfix/3073-old-setuptools.tar.gz |
Suppress loading of distutils from setuptools when the resolved version of setuptools doesn't match the hack.bugfix/3073-old-setuptools
-rw-r--r-- | _distutils_hack/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 1f8daf49..14d9bd99 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -96,6 +96,13 @@ class DistutilsMetaFinder: import importlib.abc import importlib.util + spec = importlib.util.find_spec('setuptools') + setuptools_site = os.path.dirname(os.path.dirname(spec.origin)) + hook_site = os.path.dirname(os.path.dirname(__file__)) + if setuptools_site != hook_site: + print(setuptools_site, hook_site) + return + try: mod = importlib.import_module('setuptools._distutils') except Exception: |