Skip to content

Commit

Permalink
Define create_module()/exec_module() in VendorImporter
Browse files Browse the repository at this point in the history
Fixes #2481
  • Loading branch information
hroncok committed Jan 4, 2021
1 parent 95a9c47 commit 542d24b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.d/2481.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Define ``create_module()`` and ``exec_module()`` methods in ``VendorImporter``
to get rid of ``ImportWarning`` -- by :user:`hroncok`
6 changes: 6 additions & 0 deletions pkg_resources/extern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def load_module(self, fullname):
"distribution.".format(**locals())
)

def create_module(self, spec):
return self.load_module(spec.name)

def exec_module(self, module):
pass

def install(self):
"""
Install this importer into sys.meta_path if not already present.
Expand Down
6 changes: 6 additions & 0 deletions setuptools/extern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def load_module(self, fullname):
"distribution.".format(**locals())
)

def create_module(self, spec):
return self.load_module(spec.name)

def exec_module(self, module):
pass

def install(self):
"""
Install this importer into sys.meta_path if not already present.
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ toxworkdir={env:TOX_WORK_DIR:.tox}

[testenv]
deps =
pytest
jaraco-envs
pytest-fixture-config
commands =
pytest {posargs}
usedevelop = True
Expand Down

0 comments on commit 542d24b

Please sign in to comment.