1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

raise excepten when starting broken plugin

This commit is contained in:
Michael Pöhn 2020-01-29 12:39:21 +01:00
parent bf815251ec
commit 3a3803ea2d

View File

@ -74,17 +74,19 @@ def find_plugins():
fdroid_modules = [x[1] for x in pkgutil.iter_modules() if x[1].startswith('fdroid_')]
commands = {}
for module_name in fdroid_modules:
try:
command_name = module_name[7:]
try:
module = importlib.import_module(module_name)
if hasattr(module, 'fdroid_summary') and hasattr(module, 'main'):
commands[command_name] = {'summary': module.fdroid_summary,
'module': module}
except IOError:
except Exception as e:
# We need to keep module lookup fault tolerant because buggy
# modules must not prevent fdroidserver from functioning
# TODO: think about warning users or debug logs for notifying devs
pass
if len(sys.argv) > 1 and sys.argv[1] == command_name:
# only raise exeption when a user specifies the broken
# plugin in explicitly in command line
raise e
return commands