diff options
author | Anthony Sottile <asottile@umich.edu> | 2021-12-31 09:32:20 -0800 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-01-08 12:14:25 -0500 |
commit | bd8d4dbd9638988f09b061f5d94a678c0fd80f25 (patch) | |
tree | bc20962fb296ba29ee3ee5bf033609b45023ff4f | |
parent | 91ce77e49670fb97ceaad7d7c3b414c488c65c62 (diff) | |
download | python-setuptools-git-bd8d4dbd9638988f09b061f5d94a678c0fd80f25.tar.gz |
set origin= for distutils.__spec__
set origin so spec finding reports the correct location -- https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec
-rw-r--r-- | _distutils_hack/__init__.py | 4 | ||||
-rw-r--r-- | changelog.d/2990.change.rst | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 75bc4463..cc62dcf6 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -118,7 +118,9 @@ class DistutilsMetaFinder: def exec_module(self, module): pass - return importlib.util.spec_from_loader('distutils', DistutilsLoader()) + return importlib.util.spec_from_loader( + 'distutils', DistutilsLoader(), origin=mod.__file__ + ) def spec_for_pip(self): """ diff --git a/changelog.d/2990.change.rst b/changelog.d/2990.change.rst new file mode 100644 index 00000000..bb6e6032 --- /dev/null +++ b/changelog.d/2990.change.rst @@ -0,0 +1 @@ +Set the ``.origin`` attribute of the ``distutils`` module to the module's ``__file__``. |