Skip to content

Commit

Permalink
Make spec_for_() calls explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored and jaraco committed Jan 8, 2022
1 parent 7619852 commit 2b07b8e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions _distutils_hack/__init__.py
Expand Up @@ -82,11 +82,14 @@ def match(self, string):
class DistutilsMetaFinder:
def find_spec(self, fullname, path, target=None):
if path is not None:
return

method_name = 'spec_for_{fullname}'.format(**locals())
method = getattr(self, method_name, lambda: None)
return method()
return None

if fullname == "distutils":
return self.spec_for_distutils()
elif fullname == "pip":
return self.spec_for_pip()
else:
return None

def spec_for_distutils(self):
import importlib
Expand Down

0 comments on commit 2b07b8e

Please sign in to comment.