From 9e6ca2a67102d4c133173cedaa5ca505c2082ddf Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 21 Aug 2022 20:05:20 +0900 Subject: [PATCH] Replace pdflatex to latex --- src/sage/features/latex.py | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/sage/features/latex.py b/src/sage/features/latex.py index cf65aea6afc..c3e28a6da9c 100644 --- a/src/sage/features/latex.py +++ b/src/sage/features/latex.py @@ -37,7 +37,7 @@ def __init__(self, name): sage: isinstance(latex(), latex) True """ - Executable.__init__(self, name, executable=name, spkg=latex_spkg, url=latex_url) + super().__init__(name, executable=name, spkg=latex_spkg, url=latex_url) def is_functional(self): r""" @@ -97,7 +97,7 @@ def __init__(self): sage: isinstance(latex(), latex) True """ - LaTeX.__init__(self, "latex") + super().__init__("latex") class pdflatex(LaTeX): @@ -118,7 +118,7 @@ def __init__(self): sage: isinstance(pdflatex(), pdflatex) True """ - LaTeX.__init__(self, "pdflatex") + super().__init__("pdflatex") class xelatex(LaTeX): @@ -139,7 +139,7 @@ def __init__(self): sage: isinstance(xelatex(), xelatex) True """ - LaTeX.__init__(self, "xelatex") + super().__init__("xelatex") class lualatex(LaTeX): @@ -160,7 +160,7 @@ def __init__(self): sage: isinstance(lualatex(), lualatex) True """ - LaTeX.__init__(self, "lualatex") + super().__init__("lualatex") class TeXFile(StaticFile, JoinFeature): @@ -170,20 +170,20 @@ class TeXFile(StaticFile, JoinFeature): EXAMPLES:: sage: from sage.features.latex import TeXFile - sage: TeXFile('x', 'x.tex').is_present() # optional: pdflatex + sage: TeXFile('x', 'x.tex').is_present() # optional - latex FeatureTestResult('x', True) - sage: TeXFile('nonexisting', 'xxxxxx-nonexisting-file.tex').is_present() # optional - pdflatex + sage: TeXFile('nonexisting', 'xxxxxx-nonexisting-file.tex').is_present() # optional - latex FeatureTestResult('nonexisting', False) """ def __init__(self, name, filename, **kwds): r""" EXAMPLES:: - sage: from sage.features.latex import LaTeXPackage, pdflatex + sage: from sage.features.latex import LaTeXPackage sage: LaTeXPackage("tkz-graph")._features - [Feature('pdflatex')] + [Feature('latex')] """ - JoinFeature.__init__(self, name, [pdflatex()], + JoinFeature.__init__(self, name, [latex()], spkg=latex_spkg, url=latex_url) # see :trac:`34282` StaticFile.__init__(self, name, filename, search_path=[], **kwds) @@ -195,7 +195,7 @@ def absolute_filename(self) -> str: sage: from sage.features.latex import TeXFile sage: feature = TeXFile('latex_class_article', 'article.cls') - sage: feature.absolute_filename() # optional - pdflatex + sage: feature.absolute_filename() # optional - latex '.../latex/base/article.cls' """ from subprocess import run, CalledProcessError, PIPE @@ -214,16 +214,13 @@ def _is_present(self): EXAMPLES:: - sage: from sage.features.latex import LaTeXPackage, pdflatex + sage: from sage.features.latex import LaTeXPackage, latex sage: f = LaTeXPackage("tkz-graph") - sage: g = pdflatex() - sage: bool(f.is_present()) == bool(g.is_present()) # indirect doctest + sage: g = latex() + sage: not f.is_present() or bool(g.is_present()) # indirect doctest True """ - test = JoinFeature._is_present(self) - if not test: - return test - return super(TeXFile, self)._is_present() + return JoinFeature._is_present(self) and StaticFile._is_present(self) class LaTeXPackage(TeXFile): @@ -234,7 +231,7 @@ class LaTeXPackage(TeXFile): EXAMPLES:: sage: from sage.features.latex import LaTeXPackage - sage: LaTeXPackage('graphics').is_present() # optional - pdflatex + sage: LaTeXPackage('graphics').is_present() # optional - latex FeatureTestResult('latex_package_graphics', True) """ @staticmethod