|
|
@ -35,21 +35,22 @@ def load_plugins(conf, ui):
|
|
|
|
PapersPlugin subclasses desired.
|
|
|
|
PapersPlugin subclasses desired.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
for name in conf['plugins']['active']:
|
|
|
|
for name in conf['plugins']['active']:
|
|
|
|
modname = '%s.%s.%s.%s' % ('pubs', PLUGIN_NAMESPACE, name, name)
|
|
|
|
if len(name) > 0:
|
|
|
|
try:
|
|
|
|
modname = '{}.{}.{}.{}'.format('pubs', PLUGIN_NAMESPACE, name, name)
|
|
|
|
namespace = importlib.import_module(modname)
|
|
|
|
try:
|
|
|
|
except ImportError as exc:
|
|
|
|
namespace = importlib.import_module(modname)
|
|
|
|
# Again, this is hacky:
|
|
|
|
except ImportError as exc:
|
|
|
|
if exc.args[0].endswith(' ' + name):
|
|
|
|
# Again, this is hacky:
|
|
|
|
ui.warning('plugin {} not found'.format(name))
|
|
|
|
if exc.args[0].endswith(' ' + name):
|
|
|
|
|
|
|
|
ui.warning('plugin {} not found'.format(name))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raise
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise
|
|
|
|
for obj in namespace.__dict__.values():
|
|
|
|
else:
|
|
|
|
if isinstance(obj, type) and issubclass(obj, PapersPlugin) \
|
|
|
|
for obj in namespace.__dict__.values():
|
|
|
|
and obj != PapersPlugin:
|
|
|
|
if isinstance(obj, type) and issubclass(obj, PapersPlugin) \
|
|
|
|
_classes.append(obj)
|
|
|
|
and obj != PapersPlugin:
|
|
|
|
_instances[obj] = obj(conf)
|
|
|
|
_classes.append(obj)
|
|
|
|
|
|
|
|
_instances[obj] = obj(conf)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_plugins():
|
|
|
|
def get_plugins():
|
|
|
|