Skip to content

Commit 66250f5

Browse files
committed
Drop support for Inkscape < 1
This version was released in 2020, which should be sufficiently long enough to have reached development machines.
1 parent fc457f5 commit 66250f5

4 files changed

Lines changed: 11 additions & 24 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
New minimum version of Inkscape
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The required version of Inkscape for testing SVG is now 1.0 (previously there was no
5+
minimum).

doc/install/dependencies.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ otherwise they must be installed manually:
366366
External tools
367367
^^^^^^^^^^^^^^
368368
- Ghostscript_ (>= 9.0, to render PDF files)
369-
- Inkscape_ (to render SVG files)
369+
- Inkscape_ (>= 1.0, to render SVG files)
370370
- `WenQuanYi Zen Hei`_ and `Noto Sans CJK`_ fonts for testing font fallback and
371371
non-Western fonts
372372

@@ -477,7 +477,7 @@ Optional
477477
The documentation can be built without Inkscape and optipng, but the build
478478
process will raise various warnings.
479479

480-
* Inkscape_
480+
* Inkscape_ (>= 1.0)
481481
* `optipng <http://optipng.sourceforge.net>`_
482482
* the font `xkcd script <https://github.com/ipython/xkcd-font/>`_ or `Comic Neue <https://github.com/crozynski/comicneue>`_
483483
* the font "Times New Roman"

lib/matplotlib/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,7 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
446446
message = "Failed to find a Ghostscript installation"
447447
raise ExecutableNotFoundError(message)
448448
elif name == "inkscape":
449-
try:
450-
# Try headless option first (needed for Inkscape version < 1.0):
451-
return impl(["inkscape", "--without-gui", "-V"],
452-
"Inkscape ([^ ]*)")
453-
except ExecutableNotFoundError:
454-
pass # Suppress exception chaining.
455-
# If --without-gui is not accepted, we may be using Inkscape >= 1.0 so
456-
# try without it:
457-
return impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
449+
return impl(["inkscape", "-V"], "Inkscape ([^ ]*)", min_ver="1")
458450
elif name == "magick":
459451
if sys.platform == "win32":
460452
# Check the registry to avoid confusing ImageMagick's convert with

lib/matplotlib/testing/compare.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import shutil
1212
import subprocess
1313
import sys
14-
from tempfile import TemporaryDirectory, TemporaryFile
14+
from tempfile import TemporaryDirectory
1515
import weakref
1616
import re
1717

@@ -146,8 +146,7 @@ def encode_and_escape(name):
146146

147147
class _SVGConverter(_Converter):
148148
def __call__(self, orig, dest):
149-
old_inkscape = mpl._get_executable_info("inkscape").version.major < 1
150-
terminator = b"\n>" if old_inkscape else b"> "
149+
terminator = b"> "
151150
if not hasattr(self, "_tmpdir"):
152151
self._tmpdir = TemporaryDirectory()
153152
# On Windows, we must make sure that self._proc has terminated
@@ -171,18 +170,10 @@ def __call__(self, orig, dest):
171170
# Do not load any user options.
172171
"INKSCAPE_PROFILE_DIR": self._tmpdir.name,
173172
}
174-
# Old versions of Inkscape (e.g. 0.48.3.1) seem to sometimes
175-
# deadlock when stderr is redirected to a pipe, so we redirect it
176-
# to a temporary file instead. This is not necessary anymore as of
177-
# Inkscape 0.92.1.
178-
stderr = TemporaryFile()
179173
self._proc = subprocess.Popen(
180-
["inkscape", "--without-gui", "--shell"] if old_inkscape else
181174
["inkscape", "--shell"],
182-
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=stderr,
175+
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
183176
env=env, cwd=self._tmpdir.name)
184-
# Slight abuse, but makes shutdown handling easier.
185-
self._proc.stderr = stderr
186177
try:
187178
self._read_until(terminator)
188179
except _ConverterError as err:
@@ -200,7 +191,6 @@ def __call__(self, orig, dest):
200191
except OSError:
201192
shutil.copyfile(orig, inkscape_orig)
202193
self._proc.stdin.write(
203-
b"f.svg --export-png=f.png\n" if old_inkscape else
204194
b"file-open:f.svg;export-filename:f.png;export-do;file-close\n")
205195
self._proc.stdin.flush()
206196
try:

0 commit comments

Comments
 (0)