Skip to content

Commit b7983ae

Browse files
authored
Merge branch 'master' into latex_xelatex_math
2 parents e0b4789 + 9d3087c commit b7983ae

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ Bugs fixed
6565
* #12714: LaTeX: Let ``\mathbf{\Lambda}`` work as expected if
6666
:confval:`latex_engine` is ``'xelatex'`` or ``'lualatex'``, via usage
6767
of ``unicode-math`` with XITS Math font.
68+
* #12717: LaTeX: let :option:`-q <sphinx-build -q>` (quiet) option for
69+
:program:`sphinx-build -M latexpdf` or :program:`make latexpdf` (``O=-q``)
70+
get passed to :program:`latexmk`. Let :option:`-Q <sphinx-build -Q>`
71+
(silent) apply as well to the PDF build phase.
72+
Patch by Jean-François B.
6873

6974
Testing
7075
-------

sphinx/cmd/make_mode.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,34 @@ def build_latexpdf(self) -> int:
106106
raise RuntimeError('Invalid $MAKE command: %r' % makecmd)
107107
try:
108108
with chdir(self.builddir_join('latex')):
109-
return subprocess.call([makecmd, 'all-pdf'])
109+
if '-Q' in self.opts:
110+
with open('__LATEXSTDOUT__', 'w') as outfile:
111+
returncode = subprocess.call([makecmd,
112+
'all-pdf',
113+
'LATEXOPTS=-halt-on-error',
114+
],
115+
stdout=outfile,
116+
stderr=subprocess.STDOUT,
117+
)
118+
if returncode:
119+
print('Latex error: check %s' %
120+
self.builddir_join('latex', '__LATEXSTDOUT__')
121+
)
122+
elif '-q' in self.opts:
123+
returncode = subprocess.call(
124+
[makecmd,
125+
'all-pdf',
126+
'LATEXOPTS=-halt-on-error',
127+
'LATEXMKOPTS=-silent',
128+
],
129+
)
130+
if returncode:
131+
print('Latex error: check .log file in %s' %
132+
self.builddir_join('latex')
133+
)
134+
else:
135+
returncode = subprocess.call([makecmd, 'all-pdf'])
136+
return returncode
110137
except OSError:
111138
print('Error: Failed to run: %s' % makecmd)
112139
return 1

0 commit comments

Comments
 (0)