mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix code broken during py3 migration
This commit is contained in:
parent
1b1d51b078
commit
453d467caf
@ -384,13 +384,12 @@ def create_themeball(report, progress=None, abort=None):
|
|||||||
with lopen(srcpath, 'rb') as f:
|
with lopen(srcpath, 'rb') as f:
|
||||||
zf.writestr(name, f.read(), compression=ZIP_STORED)
|
zf.writestr(name, f.read(), compression=ZIP_STORED)
|
||||||
buf.seek(0)
|
buf.seek(0)
|
||||||
out = BytesIO()
|
|
||||||
if abort is not None and abort.is_set():
|
if abort is not None and abort.is_set():
|
||||||
return None, None
|
return None, None
|
||||||
if progress is not None:
|
if progress is not None:
|
||||||
progress(next(num), _('Compressing theme file'))
|
progress(next(num), _('Compressing theme file'))
|
||||||
import lzma
|
import lzma
|
||||||
lzma.compress(buf.getvalue(), format=lzma.FORMAT_XZ, preset=9)
|
compressed = lzma.compress(buf.getvalue(), format=lzma.FORMAT_XZ, preset=9)
|
||||||
buf = BytesIO()
|
buf = BytesIO()
|
||||||
prefix = report.name
|
prefix = report.name
|
||||||
if abort is not None and abort.is_set():
|
if abort is not None and abort.is_set():
|
||||||
@ -399,7 +398,7 @@ def create_themeball(report, progress=None, abort=None):
|
|||||||
with lopen(os.path.join(report.path, THEME_METADATA), 'rb') as f:
|
with lopen(os.path.join(report.path, THEME_METADATA), 'rb') as f:
|
||||||
zf.writestr(prefix + '/' + THEME_METADATA, f.read())
|
zf.writestr(prefix + '/' + THEME_METADATA, f.read())
|
||||||
zf.writestr(prefix + '/' + THEME_COVER, create_cover(report))
|
zf.writestr(prefix + '/' + THEME_COVER, create_cover(report))
|
||||||
zf.writestr(prefix + '/' + 'icons.zip.xz', out.getvalue(), compression=ZIP_STORED)
|
zf.writestr(prefix + '/' + 'icons.zip.xz', compressed, compression=ZIP_STORED)
|
||||||
if progress is not None:
|
if progress is not None:
|
||||||
progress(next(num), _('Finished'))
|
progress(next(num), _('Finished'))
|
||||||
return buf.getvalue(), prefix
|
return buf.getvalue(), prefix
|
||||||
|
Loading…
x
Reference in New Issue
Block a user