8000 Merge pull request #11989 from anntzer/gs9 · matplotlib/matplotlib@f38a600 · GitHub
[go: up one dir, main page]

Skip to content

Commit f38a600

Browse files
authored
Merge pull request #11989 from anntzer/gs9
Remove support for ghostscript 8.60.
2 parents 3fdf3c0 + d76609c commit f38a600

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
@@ -173,11 +173,11 @@ def compare_versions(a, b):
173173
"return True if a is greater than or equal to b"
174174
if isinstance(a, bytes):
175175
cbook.warn_deprecated(
176-
"3.0", "compare_version arguments should be strs.")
176+
"3.0", "compare_versions arguments should be strs.")
177177
a = a.decode('ascii')
178178
if isinstance(b, bytes):
179179
cbook.warn_deprecated(
180-
"3.0", "compare_version arguments should be strs.")
180+
"3.0", "compare_versions arguments should be strs.")
181181
b = b.decode('ascii')
182182
if a:
183183
a = distutils.version.LooseVersion(a)
@@ -437,8 +437,9 @@ def checkdep_ghostscript():
437437
stdout, stderr = s.communicate()
438438
if s.returncode == 0:
439439
v = stdout[:-1].decode('ascii')
440-
checkdep_ghostscript.executable = gs_exec
441-
checkdep_ghostscript.version = v
440+
if compare_versions(v, '9.0'):
441+
checkdep_ghostscript.executable = gs_exec
442+
checkdep_ghostscript.version = v
442443
except (IndexError, ValueError, OSError):
443444
pass
444445
return checkdep_ghostscript.executable, checkdep_ghostscript.version
@@ -484,13 +485,12 @@ def checkdep_ps_distiller(s):
484485
return False
485486

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

495495
if s == 'xpdf':
496496
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