diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index 0a56fa0c589..e3936de51a6 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -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):