Skip to content

Commit b17a6c1

Browse files
committed
Move checkdep_ps_distiller to the rc validators.
1 parent 778d868 commit b17a6c1

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
@@ -539,6 +539,7 @@ def checkdep_inkscape():
539539
checkdep_inkscape.version = None
540540

541541

542+
@cbook.deprecated("2.2")
542543
def checkdep_ps_distiller(s):
543544
if not s:
544545
return False
@@ -548,7 +549,7 @@ def checkdep_ps_distiller(s):
548549
return False
549550
if s == "xpdf" and not get_executable_info("pdftops"):
550551
warnings.warn(
551-
"setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
552+
"Setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
552553
return False
553554
return s
554555

@@ -1162,9 +1163,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11621163
six.iteritems(defaultParams)
11631164
if key not in _all_deprecated])
11641165

1165-
rcParams['ps.usedistiller'] = checkdep_ps_distiller(
1166-
rcParams['ps.usedistiller'])
1167-
11681166
rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
11691167

11701168
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)