Skip to content

Commit 15dc6a7

Browse files
committed
Move checkdep_ps_distiller to the rc validators.
1 parent 525b793 commit 15dc6a7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/matplotlib/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ def checkdep_inkscape():
537537
checkdep_inkscape.version = None
538538

539539

540+
@cbook.deprecated("2.2")
540541
def checkdep_ps_distiller(s):
541542
if not s:
542543
return False
@@ -546,7 +547,7 @@ def checkdep_ps_distiller(s):
546547
return False
547548
if s == "xpdf" and not get_executable_info("pdftops"):
548549
warnings.warn(
549-
"setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
550+
"Setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
550551
return False
551552
return s
552553

@@ -1159,9 +1160,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11591160
six.iteritems(defaultParams)
11601161
if key not in _all_deprecated])
11611162

1162-
rcParams['ps.usedistiller'] = checkdep_ps_distiller(
1163-
rcParams['ps.usedistiller'])
1164-
11651163
rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
11661164

11671165
if rcParams['axes.formatter.use_locale']:

lib/matplotlib/rcsetup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import warnings
2626
import re
2727

28+
import matplotlib as mpl
2829
from matplotlib.cbook import mplDeprecation, deprecated, ls_mapper
2930
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
3031
from matplotlib.colors import is_color_like
@@ -505,7 +506,12 @@ def validate_ps_distiller(s):
505506
elif s in ('false', False):
506507
return False
507508
elif s in ('ghostscript', 'xpdf'):
508-
return s
509+
if not mpl.get_executable_info("gs"):
510+
warnings.warn("Setting ps.usedistiller requires ghostscript.")
511+
return False
512+
if s == "xpdf" and not mpl.get_executable_info("pdftops"):
513+
warnings.warn("Setting ps.usedistiller to 'xpdf' requires xpdf.")
514+
return False
509515
else:
510516
raise ValueError('matplotlibrc ps.usedistiller must either be none, '
511517
'ghostscript or xpdf')

0 commit comments

Comments
 (0)