Be robust on import plugin module
On loading external plugin, OSC should be robust on importing the plugin module so that commands from other modules can continue to execute. Closes-Bug: #1722008 Change-Id: Ibe716681c7f78fabee31b7ef281af2588d68ab30
This commit is contained in:
parent
a87bd58fb4
commit
599fa78262
@ -134,7 +134,13 @@ def get_plugin_modules(group):
|
|||||||
for ep in pkg_resources.iter_entry_points(group):
|
for ep in pkg_resources.iter_entry_points(group):
|
||||||
LOG.debug('Found plugin %r', ep.name)
|
LOG.debug('Found plugin %r', ep.name)
|
||||||
|
|
||||||
__import__(ep.module_name)
|
try:
|
||||||
|
__import__(ep.module_name)
|
||||||
|
except Exception:
|
||||||
|
sys.stderr.write(
|
||||||
|
"WARNING: Failed to import plugin %r.\n" % ep.name)
|
||||||
|
continue
|
||||||
|
|
||||||
module = sys.modules[ep.module_name]
|
module = sys.modules[ep.module_name]
|
||||||
mod_list.append(module)
|
mod_list.append(module)
|
||||||
init_func = getattr(module, 'Initialize', None)
|
init_func = getattr(module, 'Initialize', None)
|
||||||
|
Loading…
Reference in New Issue
Block a user