Skip to content

[WIP] Configuration to properly build PDFs in japanese and french #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@
'ko'
]

SPHINXOPTS = {
'ja': ['-D latex_engine=platex',
'-D latex_elements.inputenc=',
'-D latex_elements.fontenc='],
'fr': ['-D latex_engine=xelatex',
'-D latex_elements.inputenc=',
'-D latex_elements.fontenc='],
'en': ['-D latex_engine=xelatex',
'-D latex_elements.inputenc=',
'-D latex_elements.fontenc=']
}


def _file_unchanged(old, new):
with open(old, "rb") as fp1, open(new, "rb") as fp2:
Expand Down Expand Up @@ -163,7 +175,8 @@ def build_one(version, git_branch, isdev, quick, venv, build_root, www_root,
lang=language if language != 'en' else ''))
logging.info("Build start for version: %s, language: %s",
str(version), language)
sphinxopts = ''
sphinxopts = SPHINXOPTS[language].copy()
sphinxopts.append('-j4')
if language == 'en':
target = os.path.join(www_root, str(version))
else:
Expand All @@ -180,10 +193,10 @@ def build_one(version, git_branch, isdev, quick, venv, build_root, www_root,
git_clone(locale_repo, locale_clone_dir,
translation_branch(locale_repo, locale_clone_dir,
version))
sphinxopts += ('-D locale_dirs={} '
'-D language={} '
'-D gettext_compact=0').format(locale_dirs,
gettext_language_tag)
sphinxopts.extend((
'-D locale_dirs={}'.format(locale_dirs),
'-D language={}'.format(gettext_language_tag),
'-D gettext_compact=0'))
os.makedirs(target, exist_ok=True)
try:
os.chmod(target, 0o775)
Expand All @@ -202,7 +215,7 @@ def build_one(version, git_branch, isdev, quick, venv, build_root, www_root,
blurb = os.path.join(venv, "bin/blurb")
shell_out(
"cd Doc; make PYTHON=%s SPHINXBUILD=%s BLURB=%s VENVDIR=%s SPHINXOPTS='%s' %s >> %s 2>&1" %
(python, sphinxbuild, blurb, venv, sphinxopts, maketarget,
(python, sphinxbuild, blurb, venv, ' '.join(sphinxopts), maketarget,
os.path.join(log_directory, logname)), shell=True)
shell_out(['chgrp', '-R', group, log_directory])
changed = changed_files(os.path.join(checkout, "Doc/build/html"), target)
Expand Down