mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cant use polyglot in plugins_mirror
This commit is contained in:
parent
5918acabad
commit
6d3fcc853e
@ -33,7 +33,6 @@ from email.utils import parsedate
|
||||
from functools import partial
|
||||
from multiprocessing.pool import ThreadPool
|
||||
from xml.sax.saxutils import escape, quoteattr
|
||||
from polyglot.builtins import iteritems, itervalues
|
||||
# }}}
|
||||
|
||||
USER_AGENT = 'calibre mirror'
|
||||
@ -293,7 +292,7 @@ def get_plugin_info(raw, check_for_qt5=False):
|
||||
metadata = names[inits[0]]
|
||||
else:
|
||||
# Legacy plugin
|
||||
for name, val in iteritems(names):
|
||||
for name, val in names.items():
|
||||
if name.endswith('plugin.py'):
|
||||
metadata = val
|
||||
break
|
||||
@ -332,7 +331,7 @@ def update_plugin_from_entry(plugin, entry):
|
||||
|
||||
|
||||
def fetch_plugin(old_index, entry):
|
||||
lm_map = {plugin['thread_id']:plugin for plugin in itervalues(old_index)}
|
||||
lm_map = {plugin['thread_id']:plugin for plugin in old_index.values()}
|
||||
raw = read(entry.url)
|
||||
url, name = parse_plugin_zip_url(raw)
|
||||
if url is None:
|
||||
@ -404,7 +403,7 @@ def fetch_plugins(old_index):
|
||||
log('Failed to get plugin', entry.name, 'at', datetime.utcnow().isoformat(), 'with error:')
|
||||
log(plugin)
|
||||
# Move staged files
|
||||
for plugin in itervalues(ans):
|
||||
for plugin in ans.values():
|
||||
if plugin['file'].startswith('staging_'):
|
||||
src = plugin['file']
|
||||
plugin['file'] = src.partition('_')[-1]
|
||||
@ -412,7 +411,7 @@ def fetch_plugins(old_index):
|
||||
raw = bz2.compress(json.dumps(ans, sort_keys=True, indent=4, separators=(',', ': ')))
|
||||
atomic_write(raw, PLUGINS)
|
||||
# Cleanup any extra .zip files
|
||||
all_plugin_files = {p['file'] for p in itervalues(ans)}
|
||||
all_plugin_files = {p['file'] for p in ans.values()}
|
||||
extra = set(glob.glob('*.zip')) - all_plugin_files
|
||||
for x in extra:
|
||||
os.unlink(x)
|
||||
@ -499,7 +498,7 @@ h1 { text-align: center }
|
||||
name, count = x
|
||||
return '<tr><td>%s</td><td>%s</td></tr>\n' % (escape(name), count)
|
||||
|
||||
pstats = map(plugin_stats, sorted(iteritems(stats), reverse=True, key=lambda x:x[1]))
|
||||
pstats = map(plugin_stats, sorted(stats.items(), reverse=True, key=lambda x:x[1]))
|
||||
stats = '''\
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user