Fix #4414 (Plugin Loading Bug)

This commit is contained in:
Kovid Goyal 2010-01-04 01:31:37 -07:00
parent 1661dbf0ce
commit 2673542326
2 changed files with 4 additions and 2 deletions

View File

@ -31,7 +31,8 @@ class Plugin(object):
#: For example: ``['windows', 'osx', 'linux']
supported_platforms = []
#: The name of this plugin
#: The name of this plugin. You must set it something other
#: than Trivial Plugin for it to work.
name = 'Trivial Plugin'
#: The version of this plugin as a 3-tuple (major, minor, revision)

View File

@ -66,7 +66,8 @@ def load_plugin(path_to_zip_file):
raw = re.sub('\r\n', '\n', raw)
exec raw in locals
for x in locals.values():
if isinstance(x, type) and issubclass(x, Plugin):
if isinstance(x, type) and issubclass(x, Plugin) and \
x.name != 'Trivial Plugin':
if x.minimum_calibre_version > version or \
platform not in x.supported_platforms:
continue