Fix detection of plugin class in the KePub metadata plugins

This commit is contained in:
Kovid Goyal 2015-05-26 21:34:41 +05:30
parent 0cacdf26e6
commit 9daaa81437

View File

@ -131,6 +131,9 @@ def convert_node(fields, x, names={}, import_data=None):
return get_import_data(x.id, import_data[0][x.id], *import_data[1:]) return get_import_data(x.id, import_data[0][x.id], *import_data[1:])
raise ValueError('Could not find name %s for fields: %s' % (x.id, fields)) raise ValueError('Could not find name %s for fields: %s' % (x.id, fields))
return names[x.id] return names[x.id]
elif name == 'BinOp':
if x.right.__class__.__name__ == 'Str':
return x.right.s.decode('utf-8') if isinstance(x.right.s, bytes) else x.right.s
raise TypeError('Unknown datatype %s for fields: %s' % (x, fields)) raise TypeError('Unknown datatype %s for fields: %s' % (x, fields))
Alias = namedtuple('Alias', 'name asname') Alias = namedtuple('Alias', 'name asname')
@ -174,7 +177,7 @@ def parse_metadata(raw, namelist, zf):
if mod in { if mod in {
'calibre.customize', 'calibre.customize.conversion', 'calibre.customize', 'calibre.customize.conversion',
'calibre.ebooks.metadata.sources.base', 'calibre.ebooks.metadata.covers', 'calibre.ebooks.metadata.sources.base', 'calibre.ebooks.metadata.covers',
'calibre.devices.interface', 'calibre.ebooks.metadata.fetch', 'calibre.devices.interface', 'calibre.ebooks.metadata.fetch', 'calibre.customize.builtins',
} or re.match(r'calibre\.devices\.[a-z0-9]+\.driver', mod) is not None: } or re.match(r'calibre\.devices\.[a-z0-9]+\.driver', mod) is not None:
inames = {n.asname or n.name for n in names} inames = {n.asname or n.name for n in names}
inames = {x for x in inames if x.lower() != x} inames = {x for x in inames if x.lower() != x}