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

Skip to content

Deprecate checkdep_ps_distiller. #14046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/2019-04-26-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Deprecations
````````````

``matplotlib.checkdep_ps_distiller`` is deprecated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it deprecated? Is it useless, or is there an alternative to use instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is useless and undocumented.
Well of course you could be trying to use this to figure out whether a ps distiller that happens to match the ones that matplotlib supports is installed. In which case they can now just try to assign to rcParams["ps.usedistiller"] and see whether the setter complains. But frankly I just don't think it's a realistic use case and adding this to the changelog is essentially noise, I would say.

4 changes: 1 addition & 3 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ def checkdep_inkscape():
checkdep_inkscape.version = None


@cbook.deprecated("3.2")
def checkdep_ps_distiller(s):
if not s:
return False
Expand Down Expand Up @@ -1014,9 +1015,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
defaultParams.items()
if key not in _all_deprecated])

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

if rcParams['axes.formatter.use_locale']:
locale.setlocale(locale.LC_ALL, '')

Expand Down
20 changes: 17 additions & 3 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
"""
from collections.abc import Iterable, Mapping
from functools import reduce
import logging
import operator
import os
import re

import matplotlib as mpl
from matplotlib import cbook
from matplotlib.cbook import ls_mapper
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
Expand All @@ -28,6 +30,7 @@
from cycler import Cycler, cycler as ccycler


_log = logging.getLogger(__name__)
# The capitalized forms are needed for ipython at present; this may
# change for later versions.
interactive_bk = ['GTK3Agg', 'GTK3Cairo',
Expand Down Expand Up @@ -534,11 +537,22 @@ def update_savefig_format(value):
def validate_ps_distiller(s):
if isinstance(s, str):
s = s.lower()
if s in ('none', None):
if s in ('none', None, 'false', False):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(these values are treated the same)

return None
elif s in ('false', False):
return False
elif s in ('ghostscript', 'xpdf'):
try:
mpl._get_executable_info("gs")
except FileNotFoundError:
_log.warning("Setting rcParams['ps.usedistiller'] requires "
"ghostscript.")
return None
if s == "xpdf":
try:
mpl._get_executable_info("pdftops")
except FileNotFoundError:
_log.warning("Setting rcParams['ps.usedistiller'] to 'xpdf' "
"requires xpdf.")
return None
return s
else:
raise ValueError('matplotlibrc ps.usedistiller must either be none, '
Expand Down