[#2979] Fix Deluge start error with missing entrypoints

- An ImportError is raised if a module is listed in the entrypoint
   but is not actually installed. The code will now catch this and
   will de-list the ui module that failed.
This commit is contained in:
Calum Lind 2017-03-14 17:22:50 +00:00
parent 1e696fe6ca
commit 767503ad88
1 changed files with 9 additions and 3 deletions

View File

@ -38,9 +38,15 @@ def start_ui():
setup_translations()
# Get the registered UI entry points
ui_entrypoints = dict([(entrypoint.name, entrypoint.load())
for entrypoint in pkg_resources.iter_entry_points('deluge.ui')])
ui_titles = sorted(ui_entrypoints.keys())
ui_entrypoints = {}
for entrypoint in pkg_resources.iter_entry_points('deluge.ui'):
try:
ui_entrypoints[entrypoint.name] = entrypoint.load()
except ImportError:
# Unable to load entrypoint so skip adding it.
pass
ui_titles = sorted(ui_entrypoints)
def add_ui_options_group(_parser):
"""Function to enable reuse of UI Options group"""