Skip to content

Commit

Permalink
Run pdflatex three times during PDF build
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gregmuellegger committed Aug 22, 2015
1 parent f70e4a5 commit ef84042
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions readthedocs/doc_builder/backends/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ def build(self, **kwargs):
cmd_ret = self.build_env.run_command_class(
cls=LatexBuildCommand, cmd=cmd, cwd=latex_cwd, warn_only=True)
pdf_commands.append(cmd_ret)
for cmd in pdflatex_cmds:
cmd_ret = self.build_env.run_command_class(
cls=LatexBuildCommand, cmd=cmd, cwd=latex_cwd, warn_only=True)
pdf_commands.append(cmd_ret)
for cmd in pdflatex_cmds:
cmd_ret = self.build_env.run_command_class(
cls=LatexBuildCommand, cmd=cmd, cwd=latex_cwd, warn_only=True)
Expand Down
6 changes: 4 additions & 2 deletions readthedocs/rtd_tests/tests/test_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def test_build_pdf_latex_failures(self):
(('', ''), 1), # latex
(('', ''), 0), # makeindex
(('', ''), 0), # latex
(('', ''), 0), # latex
]
mock_obj = mock.Mock()
mock_obj.communicate.side_effect = [output for (output, status)
Expand All @@ -153,7 +154,7 @@ def test_build_pdf_latex_failures(self):

with build_env:
built_docs = task.build_docs()
self.assertEqual(self.mocks.popen.call_count, 5)
self.assertEqual(self.mocks.popen.call_count, 6)
self.assertTrue(build_env.failed)

def test_build_pdf_latex_not_failure(self):
Expand Down Expand Up @@ -182,6 +183,7 @@ def test_build_pdf_latex_not_failure(self):
(('Output written on foo.pdf', ''), 1), # latex
(('', ''), 0), # makeindex
(('', ''), 0), # latex
(('', ''), 0), # latex
]
mock_obj = mock.Mock()
mock_obj.communicate.side_effect = [output for (output, status)
Expand All @@ -192,5 +194,5 @@ def test_build_pdf_latex_not_failure(self):

with build_env:
built_docs = task.build_docs()
self.assertEqual(self.mocks.popen.call_count, 5)
self.assertEqual(self.mocks.popen.call_count, 6)
self.assertTrue(build_env.successful)

0 comments on commit ef84042

Please sign in to comment.