10000 Remove support for ghostscript 8.60. · matplotlib/matplotlib@d76609c · GitHub
[go: up one dir, main page]

Skip to content

Commit d76609c

Browse files
committed
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). (Allows removing some conditional paths and unifying the version checks to a single place, as we previously needed to handle gs<9 differently from gs>=9.)
1 parent f68063e commit d76609c

File tree

4 files changed

+23
-24
lines changed

4 files changed

+23
-24
lines changed

doc/api/next_api_changes/2018-08-17-AL-deprecations.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ API deprecations
44
The following API elements are deprecated:
55

66
- ``tk_window_focus``,
7+
- ``backend_ps.PsBackendHelper``, ``backend_ps.ps_backend_helper``,
78
- ``cbook.iterable``,
89
- ``mlab.demean``,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Remove support for ghostscript 8.60
2+
```````````````````````````````````
3+
4+
Support for ghostscript 8.60 (released in 2007) has been removed. The oldest
5+
supported version of ghostscript is now 9.0 (released in 2010).

lib/matplotlib/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ def compare_versions(a, b):
175175
"return True if a is greater than or equal to b"
176176
if isinstance(a, bytes):
177177
cbook.warn_deprecated(
178-
"3.0", "compare_version arguments should be strs.")
178+
"3.0", "compare_versions arguments should be strs.")
179179
a = a.decode('ascii')
180180
if isinstance(b, bytes):
181181
cbook.warn_deprecated(
182-
"3.0", "compare_version arguments should be strs.")
182+
"3.0", "compare_versions arguments should be strs.")
183183
b = b.decode('ascii')
184184
if a:
185185
a = distutils.version.LooseVersion(a)
@@ -445,8 +445,9 @@ def checkdep_ghostscript():
445445
stdout, stderr = s.communicate()
446446
if s.returncode == 0:
447447
v = stdout[:-1].decode('ascii')
448-
checkdep_ghostscript.executable = gs_exec
449-
checkdep_ghostscript.version = v
448+
if compare_versions(v, '9.0'):
449+
checkdep_ghostscript.executable = gs_exec
450+
checkdep_ghostscript.version = v
450451
except (IndexError, ValueError, OSError):
451452
pass
452453
return checkdep_ghostscript.executable, checkdep_ghostscript.version
@@ -492,13 +493,12 @@ def checkdep_ps_distiller(s):
492493
return False
493494

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

503503
if s == 'xpdf':
504504
pdftops_req = '3.0'

lib/matplotlib/backends/backend_ps.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def __init__(self):
4747
self._cached = {}
4848

4949
@property
50+
@cbook.deprecated("3.1")
5051
def gs_exe(self):
5152
"""
5253
executable name of ghostscript.
@@ -64,6 +65,7 @@ def gs_exe(self):
6465
return str(gs_exe)
6566

6667
@property
68+
@cbook.deprecated("3.1")
6769
def gs_version(self):
6870
"""
6971
version of ghostscript.
@@ -86,6 +88,7 @@ def gs_version(self):
8688
return gs_version
8789

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

1468-
gs_exe = ps_backend_helper.gs_exe
1469-
if ps_backend_helper.supports_ps2write: # gs version >= 9
1470-
device_name = "ps2write"
1471-
else:
1472-
device_name = "pswrite"
1473-
1471+
gs_exe, gs_version = checkdep_ghostscript()
14741472
cbook._check_and_log_subprocess(
14751473
[gs_exe, "-dBATCH", "-dNOPAUSE", "-r%d" % dpi,
1476-
"-sDEVICE=%s" % device_name, paper_option,
1474+
"-sDEVICE=ps2write", paper_option,
14771475
"-sOutputFile=%s" % psfile, tmpfile], _log)
14781476

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

14861484
if eps:
1487-
# For some versions of gs, above steps result in an ps file
1488-
# where the original bbox is no more correct. Do not adjust
1489-
# bbox for now.
1490-
if ps_backend_helper.supports_ps2write:
1491-
# fo gs version >= 9 w/ ps2write device
1492-
pstoeps(tmpfile, bbox, rotated=rotated)
1493-
else:
1494-
pstoeps(tmpfile)
1485+
# For some versions of gs, above steps result in an ps file where the
1486+
# original bbox is no more correct. Do not adjust bbox for now.
1487+
pstoeps(tmpfile, bbox, rotated=rotated)
14951488

14961489

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

0 commit comments

Comments
 (0)
0