mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix building of POT for user manual
This commit is contained in:
parent
1c1e3c1396
commit
f2ee824706
@ -11,7 +11,8 @@ from functools import partial
|
|||||||
|
|
||||||
j, d, a = os.path.join, os.path.dirname, os.path.abspath
|
j, d, a = os.path.join, os.path.dirname, os.path.abspath
|
||||||
BASE = d(a(__file__))
|
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))
|
sys.path.insert(0, d(BASE))
|
||||||
from setup import __appname__, __version__
|
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)
|
destdir = j(base, bdir)
|
||||||
if not os.path.exists(destdir):
|
if not os.path.exists(destdir):
|
||||||
os.makedirs(destdir)
|
os.makedirs(destdir)
|
||||||
ans = [SPHINX_BUILD, '-D', ('language=' + language), '-b', builder]
|
ans = SPHINX_BUILD + ['-D', ('language=' + language), '-b', builder]
|
||||||
if quiet:
|
if quiet:
|
||||||
ans.append('-q')
|
ans.append('-q')
|
||||||
if very_quiet:
|
if very_quiet:
|
||||||
@ -69,7 +70,11 @@ def build_manual(language, base):
|
|||||||
|
|
||||||
|
|
||||||
def build_pot(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))
|
print(' '.join(cmd))
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
os.remove(j(base, 'generated.pot'))
|
os.remove(j(base, 'generated.pot'))
|
||||||
@ -77,7 +82,7 @@ def build_pot(base):
|
|||||||
|
|
||||||
|
|
||||||
def build_linkcheck(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))
|
print(' '.join(cmd))
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
return base
|
return base
|
||||||
|
Loading…
x
Reference in New Issue
Block a user