diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2022-01-16 18:09:28 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-01-16 18:21:58 -0500 |
| commit | 336facde9301e041b2e33a7b46fe1d37991a7ed3 (patch) | |
| tree | 7a2cb5405a427c5f9396714f3e3927ed4e0ded66 /_distutils_hack | |
| parent | 448b84062e84ed918818d4d56fb3571f3f045848 (diff) | |
| download | python-setuptools-git-336facde9301e041b2e33a7b46fe1d37991a7ed3.tar.gz | |
Suppress distutils replacement when building or testing CPython. Fixes #2965. Fixes #3007.
Diffstat (limited to '_distutils_hack')
| -rw-r--r-- | _distutils_hack/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 399d22f1..1f8daf49 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -89,6 +89,9 @@ class DistutilsMetaFinder: return method() def spec_for_distutils(self): + if self.is_cpython(): + return + import importlib import importlib.abc import importlib.util @@ -118,6 +121,14 @@ class DistutilsMetaFinder: 'distutils', DistutilsLoader(), origin=mod.__file__ ) + @staticmethod + def is_cpython(): + """ + Suppress supplying distutils for CPython (build and tests). + Ref #2965 and #3007. + """ + return os.path.isfile('pybuilddir.txt') + def spec_for_pip(self): """ Ensure stdlib distutils when running under pip. |
