Skip to content

Commit

Permalink
Move checkdep_ps_distiller to the rc validators.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Feb 26, 2018
1 parent b7420b3 commit 3e14e50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 2 additions & 4 deletions lib/matplotlib/__init__.py
Expand Up @@ -542,6 +542,7 @@ def checkdep_inkscape():
checkdep_inkscape.version = None


@cbook.deprecated("2.2")
def checkdep_ps_distiller(s):
if not s:
return False
Expand All @@ -551,7 +552,7 @@ def checkdep_ps_distiller(s):
return False
if s == "xpdf" and not get_executable_info("pdftops"):
warnings.warn(
"setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
"Setting matplotlibrc ps.usedistiller to 'xpdf' requires xpdf.")
return False
return s

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

rcParams['ps.usedistiller'] = checkdep_ps_distiller(
rcParams['ps.usedistiller'])

rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])

if rcParams['axes.formatter.use_locale']:
Expand Down
11 changes: 8 additions & 3 deletions lib/matplotlib/rcsetup.py
Expand Up @@ -13,7 +13,6 @@
parameter set listed here should also be visited to the
:file:`matplotlibrc.template` in matplotlib's root source directory.
"""
from __future__ import absolute_import, division, print_function

import six

Expand All @@ -24,7 +23,8 @@
import warnings
import re

from matplotlib import cbook, testing
import matplotlib as mpl
from matplotlib import cbook
from matplotlib.cbook import mplDeprecation, deprecated, ls_mapper
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
from matplotlib.colors import is_color_like
Expand Down Expand Up @@ -514,7 +514,12 @@ def validate_ps_distiller(s):
elif s in ('false', False):
return False
elif s in ('ghostscript', 'xpdf'):
return s
if not mpl.get_executable_info("gs"):
warnings.warn("Setting ps.usedistiller requires ghostscript.")
return False
if s == "xpdf" and not mpl.get_executable_info("pdftops"):
warnings.warn("Setting ps.usedistiller to 'xpdf' requires xpdf.")
return False
else:
raise ValueError('matplotlibrc ps.usedistiller must either be none, '
'ghostscript or xpdf')
Expand Down

0 comments on commit 3e14e50

Please sign in to comment.