Skip to content

Commit e099b67

Browse files
committed
Fix up namespace plugins
1 parent 9d20fb0 commit e099b67

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

paths_cli/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def app_dir_plugins(posix):
3434
FilePluginLoader(commands),
3535
FilePluginLoader(app_dir_plugins(posix=False)),
3636
FilePluginLoader(app_dir_plugins(posix=True)),
37-
NamespacePluginLoader('paths_cli.plugins')
37+
NamespacePluginLoader('paths_cli_plugins')
3838
]
3939

4040
plugins = sum([loader() for loader in self.plugin_loaders], [])

paths_cli/plugin_management.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,15 @@ def iter_namespace(ns_pkg):
120120
return pkgutil.iter_modules(ns_pkg.__path__,
121121
ns_pkg.__name__ + ".")
122122

123-
ns = importlib.import_module(self.search_path)
124-
candidates = [
125-
importlib.import_module(name)
126-
for _, name, _ in iter_namespace(ns)
127-
]
123+
try:
124+
ns = importlib.import_module(self.search_path)
125+
except ModuleNotFoundError:
126+
candidates = []
127+
else:
128+
candidates = [
129+
importlib.import_module(name)
130+
for _, name, _ in iter_namespace(ns)
131+
]
128132
return candidates
129133

130134
@staticmethod

0 commit comments

Comments
 (0)