Skip to content

Commit

Permalink
Add missing methods to PathEntryFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Apr 22, 2022
1 parent ed9b1e5 commit 3c77bc6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions setuptools/command/editable_wheel.py
Expand Up @@ -542,17 +542,23 @@ def _path_hook(cls, path):
return cls
raise ImportError
@classmethod
def _paths(cls, fullname):
# Ensure __path__ is not empty for the spec to be considered a namespace.
return NAMESPACES[fullname] or MAPPING.get(fullname) or [PATH_PLACEHOLDER]
@classmethod
def find_spec(cls, fullname, target=None):
if fullname in NAMESPACES:
spec = ModuleSpec(fullname, None, is_package=True)
paths = NAMESPACES[fullname] or MAPPING.get(fullname) or [PATH_PLACEHOLDER]
# ^ We have to ensure submodule_search_locations to not be empty for the
# spec to be considered a namespace
spec.submodule_search_locations = paths
spec.submodule_search_locations = cls._paths(fullname)
return spec
return None
@classmethod
def find_module(cls, fullname):
return None
def install():
if not any(finder == _EditableFinder for finder in sys.meta_path):
Expand Down

0 comments on commit 3c77bc6

Please sign in to comment.