Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
32650: using features in plot/graphics.py and plot/multigraphics.py
Browse files Browse the repository at this point in the history
  • Loading branch information
seblabbe committed Nov 2, 2021
1 parent d455993 commit cf02094
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/sage/plot/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3310,10 +3310,14 @@ def save(self, filename, **kwds):
# on the file extension.
# PGF is handled by a different backend
if ext == '.pgf':
from sage.misc.sage_ostools import have_program
latex_implementations = [i for i in ["xelatex", "pdflatex",
"lualatex"]
if have_program(i)]
from sage.features.latex import xelatex,pdflatex,lualatex
latex_implementations = []
if xelatex().is_present():
latex_implementations.append('xelatex')
if pdflatex().is_present():
latex_implementations.append('pdflatex')
if lualatex().is_present():
latex_implementations.append('lualatex')
if not latex_implementations:
raise ValueError("Matplotlib requires either xelatex, "
"lualatex, or pdflatex.")
Expand Down
12 changes: 8 additions & 4 deletions src/sage/plot/multigraphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,14 @@ def save(self, filename, figsize=None, **kwds):
# depending on the file extension.
# PGF is handled by a different backend
if ext == '.pgf':
from sage.misc.sage_ostools import have_program
latex_implementations = [i for i in ["xelatex", "pdflatex",
"lualatex"]
if have_program(i)]
from sage.features.latex import xelatex,pdflatex,lualatex
latex_implementations = []
if xelatex().is_present():
latex_implementations.append('xelatex')
if pdflatex().is_present():
latex_implementations.append('pdflatex')
if lualatex().is_present():
latex_implementations.append('lualatex')
if not latex_implementations:
raise ValueError("Matplotlib requires either xelatex, "
"lualatex, or pdflatex.")
Expand Down

0 comments on commit cf02094

Please sign in to comment.