mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 23:40:29 +03:00
raise excepten when starting broken plugin
This commit is contained in:
parent
bf815251ec
commit
3a3803ea2d
1 changed files with 6 additions and 4 deletions
|
|
@ -74,17 +74,19 @@ def find_plugins():
|
||||||
fdroid_modules = [x[1] for x in pkgutil.iter_modules() if x[1].startswith('fdroid_')]
|
fdroid_modules = [x[1] for x in pkgutil.iter_modules() if x[1].startswith('fdroid_')]
|
||||||
commands = {}
|
commands = {}
|
||||||
for module_name in fdroid_modules:
|
for module_name in fdroid_modules:
|
||||||
try:
|
|
||||||
command_name = module_name[7:]
|
command_name = module_name[7:]
|
||||||
|
try:
|
||||||
module = importlib.import_module(module_name)
|
module = importlib.import_module(module_name)
|
||||||
if hasattr(module, 'fdroid_summary') and hasattr(module, 'main'):
|
if hasattr(module, 'fdroid_summary') and hasattr(module, 'main'):
|
||||||
commands[command_name] = {'summary': module.fdroid_summary,
|
commands[command_name] = {'summary': module.fdroid_summary,
|
||||||
'module': module}
|
'module': module}
|
||||||
except IOError:
|
except Exception as e:
|
||||||
# We need to keep module lookup fault tolerant because buggy
|
# We need to keep module lookup fault tolerant because buggy
|
||||||
# modules must not prevent fdroidserver from functioning
|
# modules must not prevent fdroidserver from functioning
|
||||||
# TODO: think about warning users or debug logs for notifying devs
|
if len(sys.argv) > 1 and sys.argv[1] == command_name:
|
||||||
pass
|
# only raise exeption when a user specifies the broken
|
||||||
|
# plugin in explicitly in command line
|
||||||
|
raise e
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue