This commit is contained in:
Kovid Goyal 2011-07-29 20:06:59 -06:00
parent b857a08d2a
commit b32c1158b0

View File

@ -7,7 +7,7 @@ __license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import os, subprocess, shutil import os, subprocess, shutil, tempfile
from lxml import etree from lxml import etree
@ -70,10 +70,12 @@ def kindlegen(oeb, opts, input_plugin, output_path):
opf = [x for x in os.listdir(tdir) if x.endswith('.opf')][0] opf = [x for x in os.listdir(tdir) if x.endswith('.opf')][0]
refactor_opf(os.path.join(tdir, opf), is_periodical, oeb.toc) refactor_opf(os.path.join(tdir, opf), is_periodical, oeb.toc)
try: try:
if os.path.exists('/tmp/kindlegen'): td = tempfile.gettempdir()
shutil.rmtree('/tmp/kindlegen') kd = os.path.join(td, 'kindlegen')
shutil.copytree(tdir, '/tmp/kindlegen') if os.path.exists(kd):
oeb.log('kindlegen intermediate output stored in: /tmp/kindlegen') shutil.rmtree(kd)
shutil.copytree(tdir, kd)
oeb.log('kindlegen intermediate output stored in: %s'%kd)
except: except:
pass pass