Skip to content

Commit ef84042

Browse files
Run pdflatex three times during PDF build
We had a report in #1557 that creating the index for the PDF does not work and that it might be related to how often we run `pdflatex` during the build. Related #1557.
1 parent f70e4a5 commit ef84042

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

readthedocs/doc_builder/backends/sphinx.py

+4
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ def build(self, **kwargs):
287287
cmd_ret = self.build_env.run_command_class(
288288
cls=LatexBuildCommand, cmd=cmd, cwd=latex_cwd, warn_only=True)
289289
pdf_commands.append(cmd_ret)
290+
for cmd in pdflatex_cmds:
291+
cmd_ret = self.build_env.run_command_class(
292+
cls=LatexBuildCommand, cmd=cmd, cwd=latex_cwd, warn_only=True)
293+
pdf_commands.append(cmd_ret)
290294
for cmd in pdflatex_cmds:
291295
cmd_ret = self.build_env.run_command_class(
292296
cls=LatexBuildCommand, cmd=cmd, cwd=latex_cwd, warn_only=True)

readthedocs/rtd_tests/tests/test_builds.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def test_build_pdf_latex_failures(self):
143143
(('', ''), 1), # latex
144144
(('', ''), 0), # makeindex
145145
(('', ''), 0), # latex
146+
(('', ''), 0), # latex
146147
]
147148
mock_obj = mock.Mock()
148149
mock_obj.communicate.side_effect = [output for (output, status)
@@ -153,7 +154,7 @@ def test_build_pdf_latex_failures(self):
153154

154155
with build_env:
155156
built_docs = task.build_docs()
156-
self.assertEqual(self.mocks.popen.call_count, 5)
157+
self.assertEqual(self.mocks.popen.call_count, 6)
157158
self.assertTrue(build_env.failed)
158159

159160
def test_build_pdf_latex_not_failure(self):
@@ -182,6 +183,7 @@ def test_build_pdf_latex_not_failure(self):
182183
(('Output written on foo.pdf', ''), 1), # latex
183184
(('', ''), 0), # makeindex
184185
(('', ''), 0), # latex
186+
(('', ''), 0), # latex
185187
]
186188
mock_obj = mock.Mock()
187189
mock_obj.communicate.side_effect = [output for (output, status)
@@ -192,5 +194,5 @@ def test_build_pdf_latex_not_failure(self):
192194

193195
with build_env:
194196
built_docs = task.build_docs()
195-
self.assertEqual(self.mocks.popen.call_count, 5)
197+
self.assertEqual(self.mocks.popen.call_count, 6)
196198
self.assertTrue(build_env.successful)

0 commit comments

Comments
 (0)