Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e14e50

Browse files
committed
Move checkdep_ps_distiller to the rc validators.
1 parent b7420b3 commit 3e14e50

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/matplotlib/__init__.py

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

544544

545+
@cbook.deprecated("2.2")
545546
def checkdep_ps_distiller(s):
546547
if not s:
547548
return False
@@ -551,7 +552,7 @@ def checkdep_ps_distiller(s):
551552
return False
552553
if s == "xpdf" and not get_executable_info("pdftops"):
553554
warnings.warn(
554-
"setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
555+
"Setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
555556
return False
556557
return s
557558

@@ -1157,9 +1158,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11571158
six.iteritems(defaultParams)
11581159
if key not in _all_deprecated])
11591160

1160-
rcParams['ps.usedistiller'] = checkdep_ps_distiller(
1161-
rcParams['ps.usedistiller'])
1162-
11631161
rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
11641162

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

lib/matplotlib/rcsetup.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
parameter set listed here should also be visited to the
1414
:file:`matplotlibrc.template` in matplotlib's root source directory.
1515
"""
16-
from __future__ import absolute_import, division, print_function
1716

1817
import six
1918

@@ -24,7 +23,8 @@
2423
import warnings
2524
import re
2625

27-
from matplotlib import cbook, testing
26+
import matplotlib as mpl
27+
from matplotlib import cbook
2828
from matplotlib.cbook import mplDeprecation, deprecated, ls_mapper
2929
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
3030
from matplotlib.colors import is_color_like
@@ -514,7 +514,12 @@ def validate_ps_distiller(s):
514514
elif s in ('false', False):
515515
return False
516516
elif s in ('ghostscript', 'xpdf'):
517-
return s
517+
if not mpl.get_executable_info("gs"):
518+
warnings.warn("Setting ps.usedistiller requires ghostscript.")
519+
return False
520+
if s == "xpdf" and not mpl.get_executable_info("pdftops"):
521+
warnings.warn("Setting ps.usedistiller to 'xpdf' requires xpdf.")
522+
return False
518523
else:
519524
raise ValueError('matplotlibrc ps.usedistiller must either be none, '
520525
'ghostscript or xpdf')

0 commit comments

Comments
 (0)