Skip to content

Commit bba5c76

Browse files
authored
Merge pull request #18902 from anntzer/imv
Move ImageMagick version exclusion to _get_executable_info.
2 parents 61fef05 + 96e5968 commit bba5c76

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/matplotlib/__init__.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
324324
# try without it:
325325
return impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
326326
elif name == "magick":
327-
path = None
328327
if sys.platform == "win32":
329328
# Check the registry to avoid confusing ImageMagick's convert with
330329
# Windows's builtin convert.exe.
@@ -339,18 +338,24 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
339338
binpath = winreg.QueryValueEx(hkey, "BinPath")[0]
340339
except OSError:
341340
pass
341+
path = None
342342
if binpath:
343343
for name in ["convert.exe", "magick.exe"]:
344344
candidate = Path(binpath, name)
345345
if candidate.exists():
346346
path = str(candidate)
347347
break
348+
if path is None:
349+
raise ExecutableNotFoundError(
350+
"Failed to find an ImageMagick installation")
348351
else:
349352
path = "convert"
350-
if path is None:
353+
info = impl([path, "--version"], r"^Version: ImageMagick (\S*)")
354+
if info.version == "7.0.10-34":
355+
# https://github.com/ImageMagick/ImageMagick/issues/2720
351356
raise ExecutableNotFoundError(
352-
"Failed to find an ImageMagick installation")
353-
return impl([path, "--version"], r"^Version: ImageMagick (\S*)")
357+
f"You have ImageMagick {info.version}, which is unsupported")
358+
return info
354359
elif name == "pdftops":
355360
info = impl(["pdftops", "-v"], "^pdftops version (.*)",
356361
ignore_exit_code=True)

lib/matplotlib/tests/test_animation.py

-5
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@ def test_save_animation_smoketest(tmpdir, writer, output, anim):
191191
def test_animation_repr_html(writer, html, want, anim):
192192
# create here rather than in the fixture otherwise we get __del__ warnings
193193
# about producing no output
194-
if writer == 'imagemagick':
195-
ret = subprocess.run(['convert', '--version'], capture_output=True)
196-
if b'7.0.10-34' in ret.stdout:
197-
# see https://github.com/ImageMagick/ImageMagick/issues/2720
198-
pytest.skip("Known bad version of imagemagick")
199194
anim = animation.FuncAnimation(**anim)
200195
with plt.rc_context({'animation.writer': writer,
201196
'animation.html': html}):

0 commit comments

Comments
 (0)