mirror of
https://github.com/beetbox/beets.git
synced 2026-03-05 12:42:12 +01:00
Prevent plugin classes from being loaded twice
This commit is contained in:
parent
2dc0e4998d
commit
e2718d792e
1 changed files with 3 additions and 3 deletions
|
|
@ -170,7 +170,7 @@ class BeetsPlugin(object):
|
|||
return func
|
||||
return helper
|
||||
|
||||
_classes = []
|
||||
_classes = set()
|
||||
def load_plugins(names=()):
|
||||
"""Imports the modules for a sequence of plugin names. Each name
|
||||
must be the name of a Python module under the "beetsplug" namespace
|
||||
|
|
@ -191,8 +191,8 @@ def load_plugins(names=()):
|
|||
else:
|
||||
for obj in getattr(namespace, name).__dict__.values():
|
||||
if isinstance(obj, type) and issubclass(obj, BeetsPlugin) \
|
||||
and obj != BeetsPlugin:
|
||||
_classes.append(obj)
|
||||
and obj != BeetsPlugin and obj not in _classes:
|
||||
_classes.add(obj)
|
||||
|
||||
except:
|
||||
log.warn('** error loading plugin %s' % name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue