Skip to content

Remove support for ghostscript 8.60. #11989

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
Sep 2, 2018
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
1 change: 1 addition & 0 deletions doc/api/next_api_changes/2018-08-17-AL-deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ API deprecations
The following API elements are deprecated:

- ``tk_window_focus``,
- ``backend_ps.PsBackendHelper``, ``backend_ps.ps_backend_helper``,
- ``cbook.iterable``,
- ``mlab.demean``,
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/2018-08-31-AL-gs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Remove support for ghostscript 8.60
```````````````````````````````````

Support for ghostscript 8.60 (released in 2007) has been removed. The oldest
supported version of ghostscript is now 9.0 (released in 2010).
18 changes: 9 additions & 9 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ def compare_versions(a, b):
"return True if a is greater than or equal to b"
if isinstance(a, bytes):
cbook.warn_deprecated(
"3.0", "compare_version arguments should be strs.")
"3.0", "compare_versions arguments should be strs.")
a = a.decode('ascii')
if isinstance(b, bytes):
cbook.warn_deprecated(
"3.0", "compare_version arguments should be strs.")
"3.0", "compare_versions arguments should be strs.")
b = b.decode('ascii')
if a:
a = distutils.version.LooseVersion(a)
Expand Down Expand Up @@ -445,8 +445,9 @@ def checkdep_ghostscript():
stdout, stderr = s.communicate()
if s.returncode == 0:
v = stdout[:-1].decode('ascii')
checkdep_ghostscript.executable = gs_exec
checkdep_ghostscript.version = v
if compare_versions(v, '9.0'):
checkdep_ghostscript.executable = gs_exec
checkdep_ghostscript.version = v
except (IndexError, ValueError, OSError):
pass
return checkdep_ghostscript.executable, checkdep_ghostscript.version
Expand Down Expand Up @@ -492,13 +493,12 @@ def checkdep_ps_distiller(s):
return False

flag = True
gs_req = '8.60'
gs_exec, gs_v = checkdep_ghostscript()
if not compare_versions(gs_v, gs_req):
if not gs_exec:
flag = False
warnings.warn(('matplotlibrc ps.usedistiller option can not be used '
'unless ghostscript-%s or later is installed on your '
'system') % gs_req)
warnings.warn('matplotlibrc ps.usedistiller option can not be used '
'unless ghostscript 9.0 or later is installed on your '
'system')

if s == 'xpdf':
pdftops_req = '3.0'
Expand Down
23 changes: 8 additions & 15 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(self):
self._cached = {}

@property
@cbook.deprecated("3.1")
def gs_exe(self):
"""
executable name of ghostscript.
Expand All @@ -64,6 +65,7 @@ def gs_exe(self):
return str(gs_exe)

@property
@cbook.deprecated("3.1")
def gs_version(self):
"""
version of ghostscript.
Expand All @@ -86,6 +88,7 @@ def gs_version(self):
return gs_version

@property
@cbook.deprecated("3.1")
def supports_ps2write(self):
"""
True if the installed ghostscript supports ps2write device.
Expand Down Expand Up @@ -1465,15 +1468,10 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
psfile = tmpfile + '.ps'
dpi = rcParams['ps.distiller.res']

gs_exe = ps_backend_helper.gs_exe
if ps_backend_helper.supports_ps2write: # gs version >= 9
device_name = "ps2write"
else:
device_name = "pswrite"

gs_exe, gs_version = checkdep_ghostscript()
cbook._check_and_log_subprocess(
[gs_exe, "-dBATCH", "-dNOPAUSE", "-r%d" % dpi,
"-sDEVICE=%s" % device_name, paper_option,
"-sDEVICE=ps2write", paper_option,
"-sOutputFile=%s" % psfile, tmpfile], _log)

os.remove(tmpfile)
Expand All @@ -1484,14 +1482,9 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
# the original bbox can be restored during the pstoeps step.

if eps:
# For some versions of gs, above steps result in an ps file
# where the original bbox is no more correct. Do not adjust
# bbox for now.
if ps_backend_helper.supports_ps2write:
# fo gs version >= 9 w/ ps2write device
pstoeps(tmpfile, bbox, rotated=rotated)
else:
pstoeps(tmpfile)
# For some versions of gs, above steps result in an ps file where the
# original bbox is no more correct. Do not adjust bbox for now.
pstoeps(tmpfile, bbox, rotated=rotated)


def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
Expand Down