Skip to content

Move ImageMagick version exclusion to _get_executable_info. #18902

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
Nov 9, 2020
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
13 changes: 9 additions & 4 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
# try without it:
return impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
elif name == "magick":
path = None
if sys.platform == "win32":
# Check the registry to avoid confusing ImageMagick's convert with
# Windows's builtin convert.exe.
Expand All @@ -339,18 +338,24 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
binpath = winreg.QueryValueEx(hkey, "BinPath")[0]
except OSError:
pass
path = None
if binpath:
for name in ["convert.exe", "magick.exe"]:
candidate = Path(binpath, name)
if candidate.exists():
path = str(candidate)
break
if path is None:
raise ExecutableNotFoundError(
"Failed to find an ImageMagick installation")
else:
path = "convert"
if path is None:
info = impl([path, "--version"], r"^Version: ImageMagick (\S*)")
if info.version == "7.0.10-34":
# https://github.com/ImageMagick/ImageMagick/issues/2720
raise ExecutableNotFoundError(
"Failed to find an ImageMagick installation")
return impl([path, "--version"], r"^Version: ImageMagick (\S*)")
f"You have ImageMagick {info.version}, which is unsupported")
return info
elif name == "pdftops":
info = impl(["pdftops", "-v"], "^pdftops version (.*)",
ignore_exit_code=True)
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/tests/test_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ def test_save_animation_smoketest(tmpdir, writer, output, anim):
def test_animation_repr_html(writer, html, want, anim):
# create here rather than in the fixture otherwise we get __del__ warnings
# about producing no output
if writer == 'imagemagick':
ret = subprocess.run(['convert', '--version'], capture_output=True)
if b'7.0.10-34' in ret.stdout:
# see https://github.com/ImageMagick/ImageMagick/issues/2720
pytest.skip("Known bad version of imagemagick")
anim = animation.FuncAnimation(**anim)
with plt.rc_context({'animation.writer': writer,
'animation.html': html}):
Expand Down