mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Fix regression in epub2lrf
This commit is contained in:
parent
fcdc318a69
commit
aa9f6fab79
@ -8,7 +8,7 @@ from calibre.ebooks import ConversionError
|
|||||||
from calibre.ebooks.lrf.html.convert_from import process_file as html_process_file
|
from calibre.ebooks.lrf.html.convert_from import process_file as html_process_file
|
||||||
from calibre.ebooks.metadata.opf import OPF
|
from calibre.ebooks.metadata.opf import OPF
|
||||||
from calibre.ebooks.metadata.epub import OCFDirReader
|
from calibre.ebooks.metadata.epub import OCFDirReader
|
||||||
from calibre.libunzip import extract as zip_extract
|
from calibre.utils.zipfile import ZipFile
|
||||||
from calibre import __appname__, setup_cli_handlers
|
from calibre import __appname__, setup_cli_handlers
|
||||||
|
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ def generate_html(pathtoepub, logger):
|
|||||||
tdir = mkdtemp(prefix=__appname__+'_')
|
tdir = mkdtemp(prefix=__appname__+'_')
|
||||||
os.rmdir(tdir)
|
os.rmdir(tdir)
|
||||||
try:
|
try:
|
||||||
zip_extract(pathtoepub, tdir)
|
ZipFile(pathtoepub).extractall(tdir)
|
||||||
except:
|
except:
|
||||||
if os.path.exists(tdir) and os.path.isdir(tdir):
|
if os.path.exists(tdir) and os.path.isdir(tdir):
|
||||||
shutil.rmtree(tdir)
|
shutil.rmtree(tdir)
|
||||||
|
@ -1028,7 +1028,7 @@ class ZipFile:
|
|||||||
|
|
||||||
# Create all upper directories if necessary.
|
# Create all upper directories if necessary.
|
||||||
upperdirs = os.path.dirname(targetpath)
|
upperdirs = os.path.dirname(targetpath)
|
||||||
if upperdirs and not os.path.isdir(upperdirs):
|
if upperdirs and os.path.exists(upperdirs) and not os.path.isdir(upperdirs):
|
||||||
os.unlink(upperdirs)
|
os.unlink(upperdirs)
|
||||||
if upperdirs and not os.path.exists(upperdirs):
|
if upperdirs and not os.path.exists(upperdirs):
|
||||||
os.makedirs(upperdirs)
|
os.makedirs(upperdirs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user