8000 Skip some uses of packaging's PEP440 version for non-Python versions. by anntzer · Pull Request #21639 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Skip some uses of packaging's PEP440 version for non-Python versions. #21639

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 15, 2021
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
8000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def wrapper(**kwargs):
return wrapper


_ExecInfo = namedtuple("_ExecInfo", "executable version")
_ExecInfo = namedtuple("_ExecInfo", "executable raw_version version")


class ExecutableNotFoundError(FileNotFoundError):
Expand Down Expand Up @@ -339,12 +339,13 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
raise ExecutableNotFoundError(str(_ose)) from _ose
match = re.search(regex, output)
if match:
version = parse_version(match.group(1))
raw_version = match.group(1)
version = parse_version(raw_version)
if min_ver is not None and version < parse_version(min_ver):
raise ExecutableNotFoundError(
f"You have {args[0]} version {version} but the minimum "
f"version supported by Matplotlib is {min_ver}")
return _ExecInfo(args[0], version)
return _ExecInfo(args[0], raw_version, version)
else:
raise ExecutableNotFoundError(
f"Failed to determine the version of {args[0]} from "
Expand Down Expand Up @@ -401,7 +402,7 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
else:
path = "convert"
info = impl([path, "--version"], r"^Version: ImageMagick (\S*)")
if info.version == parse_version("7.0.10-34"):
if info.raw_version == "7.0.10-34":
# https://github.com/ImageMagick/ImageMagick/issues/2720
raise ExecutableNotFoundError(
f"You have ImageMagick {info.version}, which is unsupported")
Expand Down
5 changes: 2 additions & 3 deletions lib/matplotlib/backends/qt_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ def _isdeleted(obj):
# https://bugreports.qt.io/browse/QTBUG-87014, fixed in qt 5.15.2
if (sys.platform == 'darwin' and
parse_version(platform.mac_ver()[0]) >= parse_version("10.16") and
parse_version(QtCore.qVersion()) < parse_version("5.15.2") and
"QT_MAC_WANTS_LAYER" not in os.environ):
os.environ["QT_MAC_WANTS_LAYER"] = "1"
QtCore.QLibraryInfo.version().segments() <= [5, 15, 2]):
os.environ.setdefault("QT_MAC_WANTS_LAYER", "1")


# PyQt6 enum compat helpers.
Expand Down
6 changes: 2 additions & 4 deletions lib/matplotlib/texmanager.py
496F
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from tempfile import TemporaryDirectory

import numpy as np
from packaging.version import parse as parse_version

import matplotlib as mpl
from matplotlib import _api, cbook, dviread, rcParams
Expand Down Expand Up @@ -291,9 +290,8 @@ def make_png(self, tex, fontsize, dpi):
# dvipng 1.16 has a bug (fixed in f3ff241) that breaks --freetype0
# mode, so for it we keep FreeType enabled; the image will be
# slightly off.
bad_ver = parse_version("1.16")
if (getattr(mpl, "_called_from_pytest", False)
and mpl._get_executable_info("dvipng").version != bad_ver):
if (getattr(mpl, "_called_from_pytest", False) and
mpl._get_executable_info("dvipng").raw_version != "1.16"):
cmd.insert(1, "--freetype0")
self._run_checked_subprocess(cmd, tex)
return pngfile
Expand Down
0