mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Skip PDF version of manual for Japanese
Getting a useable Japanese PDF out of Sphinx+LaTeX is a nightmare
This commit is contained in:
parent
5f8e533045
commit
46cc7dc6c2
@ -42,29 +42,31 @@ def build_manual(language, base):
|
||||
sb = partial(sphinx_build, language, base)
|
||||
onlinedir = sb(t='online')
|
||||
epubdir = sb('myepub', 'epub')
|
||||
latexdir = sb('latex', 'latex')
|
||||
pwd = os.getcwd()
|
||||
os.chdir(latexdir)
|
||||
pdf_ok = language not in ('ja',)
|
||||
if pdf_ok:
|
||||
latexdir = sb('latex', 'latex')
|
||||
pwd = os.getcwd()
|
||||
os.chdir(latexdir)
|
||||
|
||||
def run_cmd(cmd):
|
||||
p = subprocess.Popen(cmd, stdout=open(os.devnull, 'wb'), stdin=subprocess.PIPE)
|
||||
p.stdin.close()
|
||||
return p.wait()
|
||||
try:
|
||||
for i in range(3):
|
||||
run_cmd(['xelatex', '-interaction=nonstopmode', 'calibre.tex'])
|
||||
run_cmd(['makeindex', '-s', 'python.ist', 'calibre.idx'])
|
||||
for i in range(2):
|
||||
run_cmd(['xelatex', '-interaction=nonstopmode', 'calibre.tex'])
|
||||
if not os.path.exists('calibre.pdf'):
|
||||
print('Failed to build pdf file, see calibre.log in the latex directory', file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
finally:
|
||||
os.chdir(pwd)
|
||||
def run_cmd(cmd):
|
||||
p = subprocess.Popen(cmd, stdout=open(os.devnull, 'wb'), stdin=subprocess.PIPE)
|
||||
p.stdin.close()
|
||||
return p.wait()
|
||||
try:
|
||||
for i in range(3):
|
||||
run_cmd(['xelatex', '-interaction=nonstopmode', 'calibre.tex'])
|
||||
run_cmd(['makeindex', '-s', 'python.ist', 'calibre.idx'])
|
||||
for i in range(2):
|
||||
run_cmd(['xelatex', '-interaction=nonstopmode', 'calibre.tex'])
|
||||
if not os.path.exists('calibre.pdf'):
|
||||
print('Failed to build pdf file, see calibre.log in the latex directory', file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
finally:
|
||||
os.chdir(pwd)
|
||||
pdf_dest = j(onlinedir, 'calibre.pdf')
|
||||
shutil.copyfile(j(latexdir, 'calibre.pdf'), pdf_dest)
|
||||
epub_dest = j(onlinedir, 'calibre.epub')
|
||||
pdf_dest = j(onlinedir, 'calibre.pdf')
|
||||
shutil.copyfile(j(epubdir, 'calibre.epub'), epub_dest)
|
||||
shutil.copyfile(j(latexdir, 'calibre.pdf'), pdf_dest)
|
||||
epub_to_azw3(epub_dest)
|
||||
|
||||
|
||||
|
@ -164,7 +164,7 @@ class Manual(Command):
|
||||
languages = opts.language or list(
|
||||
json.load(open(self.j(base, 'locale', 'completed.json'), 'rb'))
|
||||
)
|
||||
languages = ['en'] + list(set(languages) - {'en', 'ja'})
|
||||
languages = ['en'] + list(set(languages) - {'en'})
|
||||
os.environ['ALL_USER_MANUAL_LANGUAGES'] = ' '.join(languages)
|
||||
for language in languages:
|
||||
jobs.append(create_job([
|
||||
|
Loading…
x
Reference in New Issue
Block a user