Dont build PDF version of manual in Turkish as sphinx produces broken Tex output for that language

This commit is contained in:
Kovid Goyal 2017-08-04 09:34:59 +05:30
parent f6b8381018
commit 032a4bdd78
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -41,6 +41,7 @@ def sphinx_build(language, base, builder='html', bdir='html', t=None, quiet=True
def build_manual(language, base): def build_manual(language, base):
sb = partial(sphinx_build, language, base) sb = partial(sphinx_build, language, base)
skip_pdf = language == 'tr'
onlinedir = sb(t='online') onlinedir = sb(t='online')
epubdir = sb('myepub', 'epub') epubdir = sb('myepub', 'epub')
latexdir = sb('mylatex', 'latex') latexdir = sb('mylatex', 'latex')
@ -52,20 +53,22 @@ def build_manual(language, base):
p.stdin.close() p.stdin.close()
return p.wait() return p.wait()
try: try:
for i in xrange(3): if not skip_pdf:
run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex']) for i in xrange(3):
run_cmd(['makeindex', '-s', 'python.ist', 'calibre.idx']) run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex'])
for i in xrange(2): run_cmd(['makeindex', '-s', 'python.ist', 'calibre.idx'])
run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex']) for i in xrange(2):
if not os.path.exists('calibre.pdf'): run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex'])
print('Failed to build pdf file, see calibre.log in the latex directory', file=sys.stderr) if not os.path.exists('calibre.pdf'):
raise SystemExit(1) print('Failed to build pdf file, see calibre.log in the latex directory', file=sys.stderr)
raise SystemExit(1)
finally: finally:
os.chdir(pwd) os.chdir(pwd)
epub_dest = j(onlinedir, 'calibre.epub') epub_dest = j(onlinedir, 'calibre.epub')
pdf_dest = j(onlinedir, 'calibre.pdf') pdf_dest = j(onlinedir, 'calibre.pdf')
shutil.copyfile(j(epubdir, 'calibre.epub'), epub_dest) shutil.copyfile(j(epubdir, 'calibre.epub'), epub_dest)
shutil.copyfile(j(latexdir, 'calibre.pdf'), pdf_dest) if not skip_pdf:
shutil.copyfile(j(latexdir, 'calibre.pdf'), pdf_dest)
epub_to_azw3(epub_dest) epub_to_azw3(epub_dest)