Fix building of POT for user manual

This commit is contained in:
Kovid Goyal 2020-08-23 13:57:30 +05:30
parent 1c1e3c1396
commit f2ee824706
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -11,7 +11,8 @@ from functools import partial
j, d, a = os.path.join, os.path.dirname, os.path.abspath
BASE = d(a(__file__))
SPHINX_BUILD = 'sphinx-build'
SPHINX_BUILD = ['sphinx-build']
is_ci = os.environ.get('CI') == 'true'
sys.path.insert(0, d(BASE))
from setup import __appname__, __version__
@ -23,7 +24,7 @@ def sphinx_build(language, base, builder='html', bdir='html', t=None, quiet=True
destdir = j(base, bdir)
if not os.path.exists(destdir):
os.makedirs(destdir)
ans = [SPHINX_BUILD, '-D', ('language=' + language), '-b', builder]
ans = SPHINX_BUILD + ['-D', ('language=' + language), '-b', builder]
if quiet:
ans.append('-q')
if very_quiet:
@ -69,7 +70,11 @@ def build_manual(language, base):
def build_pot(base):
cmd = [SPHINX_BUILD, '-b', 'gettext', '-t', 'online', '-t', 'gettext', '.', base]
cmd = SPHINX_BUILD + ['-b', 'gettext', '-t', 'online', '-t', 'gettext', '.', base]
if is_ci:
sp = eval(subprocess.check_output(['python', '-c', 'import sphinx; print(sphinx.__path__)']).decode('utf-8'))
code = f'import sys, os; sys.path += [{os.path.dirname(sp[0])!r}]; from sphinx.cmd.build import main; main({cmd[1:]!r})'
cmd = [sys.executable, '-c', code]
print(' '.join(cmd))
subprocess.check_call(cmd)
os.remove(j(base, 'generated.pot'))
@ -77,7 +82,7 @@ def build_pot(base):
def build_linkcheck(base):
cmd = [SPHINX_BUILD, '-b', 'linkcheck', '-t', 'online', '-t', 'linkcheck', '.', base]
cmd = SPHINX_BUILD + ['-b', 'linkcheck', '-t', 'online', '-t', 'linkcheck', '.', base]
print(' '.join(cmd))
subprocess.check_call(cmd)
return base