Skip to content

Commit

Permalink
Merge branch 'master' into latex_DUrole
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu authored Aug 11, 2024
2 parents 98ee5a3 + 9d3087c commit 824f0a4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Bugs fixed
Patch by Hugo van Kemenade.
* #12645: Correctly support custom gettext output templates.
Patch by Jeremy Bowman.
* #12717: LaTeX: let :option:`-q <sphinx-build -q>` (quiet) option for
:program:`sphinx-build -M latexpdf` or :program:`make latexpdf` (``O=-q``)
get passed to :program:`latexmk`. Let :option:`-Q <sphinx-build -Q>`
(silent) apply as well to the PDF build phase.
Patch by Jean-François B.
* #12744: Classes injected by a custom interpreted text role now give rise to
nested ``\DUrole``'s, rather than a single one with comma separated classes.
Patch by Jean-François B.
Expand Down
29 changes: 28 additions & 1 deletion sphinx/cmd/make_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,34 @@ def build_latexpdf(self) -> int:
raise RuntimeError('Invalid $MAKE command: %r' % makecmd)
try:
with chdir(self.builddir_join('latex')):
return subprocess.call([makecmd, 'all-pdf'])
if '-Q' in self.opts:
with open('__LATEXSTDOUT__', 'w') as outfile:
returncode = subprocess.call([makecmd,
'all-pdf',
'LATEXOPTS=-halt-on-error',
],
stdout=outfile,
stderr=subprocess.STDOUT,
)
if returncode:
print('Latex error: check %s' %
self.builddir_join('latex', '__LATEXSTDOUT__')
)
elif '-q' in self.opts:
returncode = subprocess.call(
[makecmd,
'all-pdf',
'LATEXOPTS=-halt-on-error',
'LATEXMKOPTS=-silent',
],
)
if returncode:
print('Latex error: check .log file in %s' %
self.builddir_join('latex')
)
else:
returncode = subprocess.call([makecmd, 'all-pdf'])
return returncode
except OSError:
print('Error: Failed to run: %s' % makecmd)
return 1
Expand Down

0 comments on commit 824f0a4

Please sign in to comment.