mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'py3-zlib' of https://github.com/flaviut/calibre
This commit is contained in:
commit
3fff9ec9cd
@ -31,7 +31,8 @@
|
|||||||
"inc_dirs": "!zlib_inc_dirs",
|
"inc_dirs": "!zlib_inc_dirs",
|
||||||
"lib_dirs": "!zlib_lib_dirs",
|
"lib_dirs": "!zlib_lib_dirs",
|
||||||
"libraries": "z",
|
"libraries": "z",
|
||||||
"windows_libraries": "zlib"
|
"windows_libraries": "zlib",
|
||||||
|
"needs_py2": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "certgen",
|
"name": "certgen",
|
||||||
|
@ -12,9 +12,8 @@ from io import BytesIO, DEFAULT_BUFFER_SIZE
|
|||||||
from itertools import chain, repeat, izip_longest
|
from itertools import chain, repeat, izip_longest
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from polyglot.builtins import map
|
|
||||||
|
|
||||||
from polyglot.builtins import reraise
|
from polyglot.builtins import reraise, map, is_py3
|
||||||
|
|
||||||
from calibre import guess_type, force_unicode
|
from calibre import guess_type, force_unicode
|
||||||
from calibre.constants import __version__, plugins
|
from calibre.constants import __version__, plugins
|
||||||
@ -31,9 +30,12 @@ from calibre.utils.monotonic import monotonic
|
|||||||
Range = namedtuple('Range', 'start stop size')
|
Range = namedtuple('Range', 'start stop size')
|
||||||
MULTIPART_SEPARATOR = uuid.uuid4().hex.decode('ascii')
|
MULTIPART_SEPARATOR = uuid.uuid4().hex.decode('ascii')
|
||||||
COMPRESSIBLE_TYPES = {'application/json', 'application/javascript', 'application/xml', 'application/oebps-package+xml'}
|
COMPRESSIBLE_TYPES = {'application/json', 'application/javascript', 'application/xml', 'application/oebps-package+xml'}
|
||||||
|
if is_py3:
|
||||||
|
import zlib
|
||||||
|
else:
|
||||||
zlib, zlib2_err = plugins['zlib2']
|
zlib, zlib2_err = plugins['zlib2']
|
||||||
if zlib2_err:
|
if zlib2_err:
|
||||||
raise RuntimeError('Failed to laod the zlib2 module with error: ' + zlib2_err)
|
raise RuntimeError('Failed to load the zlib2 module with error: ' + zlib2_err)
|
||||||
del zlib2_err
|
del zlib2_err
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user