Skip to content

Commit

Permalink
LaTeX: let latexpdf implement '-q' and '-Q' sphinx-build options
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu committed Aug 3, 2024
1 parent df871ab commit 1f4b6ba
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion sphinx/cmd/make_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,33 @@ 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 -interaction=batchmode',
],
)
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 1f4b6ba

Please sign in to comment.