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

Skip to content

Commit e2bec3f

Browse files
authored
Merge pull request #14046 from anntzer/checkdep_ps_distiller
Deprecate checkdep_ps_distiller.
2 parents ac4b31a + 968f979 commit e2bec3f

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Deprecations
2+
````````````
3+
4+
``matplotlib.checkdep_ps_distiller`` is deprecated.

lib/matplotlib/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ def checkdep_inkscape():
460460
checkdep_inkscape.version = None
461461

462462

463+
@cbook.deprecated("3.2")
463464
def checkdep_ps_distiller(s):
464465
if not s:
465466
return False
@@ -958,9 +959,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
958959
defaultParams.items()
959960
if key not in _all_deprecated])
960961

961-
rcParams['ps.usedistiller'] = checkdep_ps_distiller(
962-
rcParams['ps.usedistiller'])
963-
964962
if rcParams['axes.formatter.use_locale']:
965963
locale.setlocale(locale.LC_ALL, '')
966964

lib/matplotlib/rcsetup.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
"""
1616
from collections.abc import Iterable, Mapping
1717
from functools import reduce
18+
import logging
1819
import operator
1920
import os
2021
import re
2122

23+
import matplotlib as mpl
2224
from matplotlib import cbook
2325
from matplotlib.cbook import ls_mapper
2426
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
@@ -28,6 +30,7 @@
2830
from cycler import Cycler, cycler as ccycler
2931

3032

33+
_log = logging.getLogger(__name__)
3134
# The capitalized forms are needed for ipython at present; this may
3235
# change for later versions.
3336
interactive_bk = ['GTK3Agg', 'GTK3Cairo',
@@ -534,11 +537,22 @@ def update_savefig_format(value):
534537
def validate_ps_distiller(s):
535538
if isinstance(s, str):
536539
s = s.lower()
537-
if s in ('none', None):
540+
if s in ('none', None, 'false', False):
538541
return None
539-
elif s in ('false', False):
540-
return False
541542
elif s in ('ghostscript', 'xpdf'):
543+
try:
544+
mpl._get_executable_info("gs")
545+
except FileNotFoundError:
546+
_log.warning("Setting rcParams['ps.usedistiller'] requires "
547+
"ghostscript.")
548+
return None
549+
if s == "xpdf":
550+
try:
551+
mpl._get_executable_info("pdftops")
552+
except FileNotFoundError:
553+
_log.warning("Setting rcParams['ps.usedistiller'] to 'xpdf' "
554+
"requires xpdf.")
555+
return None
542556
return s
543557
else:
544558
raise ValueError('matplotlibrc ps.usedistiller must either be none, '

0 commit comments

Comments
 (0)