Skip to content

Commit 18fd136

Browse files
committed
plugins: support multiple sopel.modules submodule search locations
I'll be the first to admit, this doesn't actually *change* the built-in plugins that are enumerated. But that was also the point: It *should* give the same list as before. Doing this is all about code hygiene. I just don't like blindly pulling the `[0]`th element of a list and ignoring the rest, even if that list only has a single entry. So the code to `find_internal_plugins()` now accounts for the possibility that there could be multiple places it has to search for those, and deduplicates the names found before trying to load them.
1 parent 5c24a97 commit 18fd136

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sopel/plugins/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,14 @@ def find_internal_plugins():
6868
include the ``coretasks`` plugin.
6969
"""
7070
modules = importlib.util.find_spec('sopel.modules')
71-
submodule_dir = modules.submodule_search_locations[0] # only one expected
72-
for name, _ in _list_plugin_filenames(submodule_dir):
71+
plugin_list = itertools.chain(
72+
itertools.chain.from_iterable([
73+
_list_plugin_filenames(path)
74+
for path in modules.submodule_search_locations
75+
])
76+
)
77+
78+
for name, _ in set(plugin_list):
7379
yield handlers.PyModulePlugin(name, 'sopel.modules')
7480

7581

0 commit comments

Comments
 (0)