@@ -336,38 +336,6 @@ def sphinx_parallel_arg(self):
336
336
return ['-j' , 'auto' ]
337
337
return []
338
338
339
- def venv_sphinx_supports_latexmk (self ):
340
- """
341
- Check if ``sphinx`` from the user's venv supports ``latexmk``.
342
-
343
- If the version of ``sphinx`` is greater or equal to 1.6.1 it returns
344
- ``True`` and ``False`` otherwise.
345
-
346
- See: https://www.sphinx-doc.org/en/master/changes.html#release-1-6-1-released-may-16-2017
347
- """
348
-
349
- command = [
350
- self .python_env .venv_bin (filename = 'python' ),
351
- '-c' ,
352
- (
353
- '"'
354
- 'import sys; '
355
- 'import sphinx; '
356
- 'sys.exit(0 if sphinx.version_info >= (1, 6, 1) else 1)'
357
- '"'
358
- ),
359
- ]
360
-
361
- cmd_ret = self .run (
362
- * command ,
363
- bin_path = self .python_env .venv_bin (),
364
- cwd = self .project_path ,
365
- escape_command = False , # used on DockerBuildCommand
366
- shell = True , # used on BuildCommand
367
- record = False ,
368
- )
369
- return cmd_ret .exit_code == 0
370
-
371
339
372
340
class HtmlBuilder (BaseSphinx ):
373
341
relative_output_dir = "_readthedocs/html"
@@ -548,12 +516,7 @@ def build(self):
548
516
raise BuildUserError ("No TeX files were found." )
549
517
550
518
# Run LaTeX -> PDF conversions
551
- # Build PDF with ``latexmk`` if Sphinx supports it, otherwise fallback
552
- # to ``pdflatex`` to support old versions
553
- if self .venv_sphinx_supports_latexmk ():
554
- success = self ._build_latexmk (self .project_path )
555
- else :
556
- success = self ._build_pdflatex (tex_files )
519
+ success = self ._build_latexmk (self .project_path )
557
520
558
521
self ._post_build ()
559
522
return success
@@ -625,59 +588,6 @@ def _build_latexmk(self, cwd):
625
588
626
589
return cmd_ret .successful
627
590
628
- def _build_pdflatex (self , tex_files ):
629
- pdflatex_cmds = [
630
- ['pdflatex' , '-interaction=nonstopmode' , tex_file ]
631
- for tex_file in tex_files
632
- ] # yapf: disable
633
- makeindex_cmds = [
634
- [
635
- "makeindex" ,
636
- "-s" ,
637
- "python.ist" ,
638
- "{}.idx" .format (
639
- os .path .splitext (
640
- os .path .relpath (tex_file , self .absolute_output_dir )
641
- )[0 ],
642
- ),
643
- ]
644
- for tex_file in tex_files
645
- ] # yapf: disable
646
-
647
- if self .build_env .command_class == DockerBuildCommand :
648
- latex_class = DockerLatexBuildCommand
649
- else :
650
- latex_class = LatexBuildCommand
651
- pdf_commands = []
652
- for cmd in pdflatex_cmds :
653
- cmd_ret = self .build_env .run_command_class (
654
- cls = latex_class ,
655
- cmd = cmd ,
656
- cwd = self .absolute_output_dir ,
657
- warn_only = True ,
658
- )
659
- pdf_commands .append (cmd_ret )
660
- for cmd in makeindex_cmds :
661
- cmd_ret = self .build_env .run_command_class (
662
- cls = latex_class ,
663
- cmd = cmd ,
664
- cwd = self .absolute_output_dir ,
665
- warn_only = True ,
666
- )
667
- pdf_commands .append (cmd_ret )
668
- for cmd in pdflatex_cmds :
669
- cmd_ret = self .build_env .run_command_class (
670
- cls = latex_class ,
671
- cmd = cmd ,
672
- cwd = self .absolute_output_dir ,
673
- warn_only = True ,
674
- )
675
- pdf_match = PDF_RE .search (cmd_ret .output )
676
- if pdf_match :
677
- self .pdf_file_name = pdf_match .group (1 ).strip ()
678
- pdf_commands .append (cmd_ret )
679
- return all (cmd .successful for cmd in pdf_commands )
680
-
681
591
def _post_build (self ):
682
592
"""Internal post build to cleanup PDF output directory and leave only one .pdf file."""
683
593
0 commit comments