Avoid duplicates when finding plugin modules

Since PyInstaller added support for iter_modules in release 4.4, our
previous hack just duplicates all modules. If this works as intended, we
can remove our hack in the future.
This commit is contained in:
Tobias Gruetzmacher 2022-05-28 21:05:12 +02:00
parent 5550217c02
commit 839deb03e8

View file

@ -22,11 +22,11 @@ def get_plugin_modules():
@rtype: iterator of module
"""
prefix = plugin_package + "."
modules = [m[1] for m in pkgutil.iter_modules(plugin_path, prefix)]
modules = {m[1] for m in pkgutil.iter_modules(plugin_path, prefix)}
for elm in _get_all_modules_pyinstaller():
if elm.startswith(prefix):
modules.append(elm)
modules.add(elm)
for name in modules:
try: