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 Jan 22, 2018
1 parent 50f0d32 commit 43b8fb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/matplotlib/__init__.py
Expand Up @@ -534,6 +534,7 @@ def checkdep_inkscape():
checkdep_inkscape.version = None


@cbook.deprecated("2.2")
def checkdep_ps_distiller(s):
if not s:
return False
Expand All @@ -543,7 +544,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 @@ -1148,9 +1149,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
8 changes: 7 additions & 1 deletion lib/matplotlib/rcsetup.py
Expand Up @@ -24,6 +24,7 @@
import warnings
import re

import matplotlib as mpl
from matplotlib import cbook
from matplotlib.cbook import mplDeprecation, deprecated, ls_mapper
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
Expand Down Expand Up @@ -504,7 +505,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 43b8fb4

Please sign in to comment.