Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Skip loading plugins that fail to import unless specified.

  • Loading branch information...
commit 1b1e3379b02e3bf636ae69e3b8d0d1e063e6e41b 1 parent 5e186ee
Max Goodman authored spladug committed
Showing with 11 additions and 1 deletion.
  1. +1 −0  r2/Makefile.py
  2. +10 −1 r2/r2/lib/plugin.py
View
1  r2/Makefile.py
@@ -30,6 +30,7 @@
plugins = PluginLoader()
print 'PLUGINS := ' + ' '.join(plugin.name for plugin in plugins
if plugin.needs_static_build)
+import sys
for plugin in plugins:
print 'PLUGIN_PATH_%s := %s' % (plugin.name, plugin.path)
View
11 r2/r2/lib/plugin.py
@@ -100,7 +100,16 @@ def __init__(self, plugin_names=None):
self.plugins = OrderedDict()
for entry_point in entry_points:
- plugin_cls = entry_point.load()
+ try:
+ plugin_cls = entry_point.load()
+ except Exception as e:
+ if plugin_names:
+ # if this plugin was specifically requested, fail.
+ raise e
+ else:
+ print >> sys.stderr, ("Error loading plugin %s (%s)."
+ " Skipping." % (entry_point.name, e))
+ continue
self.plugins[entry_point.name] = plugin_cls(entry_point)
def __len__(self):
Please sign in to comment.
Something went wrong with that request. Please try again.