Skip to content

Commit

Permalink
set origin= for distutils.__spec__
Browse files Browse the repository at this point in the history
set origin so spec finding reports the correct location -- https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec
  • Loading branch information
asottile authored and jaraco committed Jan 8, 2022
1 parent 91ce77e commit bd8d4db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion _distutils_hack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def create_module(self, spec):
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):
"""
Expand Down
1 change: 1 addition & 0 deletions changelog.d/2990.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set the ``.origin`` attribute of the ``distutils`` module to the module's ``__file__``.

0 comments on commit bd8d4db

Please sign in to comment.