Skip to content

Commit 43b8fb4

Browse files
committed
Move checkdep_ps_distiller to the rc validators.
1 parent 50f0d32 commit 43b8fb4

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
@@ -534,6 +534,7 @@ def checkdep_inkscape():
534534
checkdep_inkscape.version = None
535535

536536

537+
@cbook.deprecated("2.2")
537538
def checkdep_ps_distiller(s):
538539
if not s:
539540
return False
@@ -543,7 +544,7 @@ def checkdep_ps_distiller(s):
543544
return False
544545
if s == "xpdf" and not get_executable_info("pdftops"):
545546
warnings.warn(
546-
"setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
547+
"Setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
547548
return False
548549
return s
549550

@@ -1148,9 +1149,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11481149
six.iteritems(defaultParams)
11491150
if key not in _all_deprecated])
11501151

1151-
rcParams['ps.usedistiller'] = checkdep_ps_distiller(
1152-
rcParams['ps.usedistiller'])
1153-
11541152
rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
11551153

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

lib/matplotlib/rcsetup.py

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

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

0 commit comments

Comments
 (0)