Compare commits

...

4 Commits

Author SHA1 Message Date
Orion Poplawski
14b07f66b9 Re-enable wx support (bz#2211203) 2023-07-16 16:16:23 -06:00
Carl George
dd4b1792bc Fix compatibility with Pillow 9.1 2023-04-15 01:36:00 -05:00
Elliott Sales de Andrade
93f88a6307 Fix return type in get_data_path patch. 2021-08-25 16:14:19 -04:00
Elliott Sales de Andrade
853e3b217e Update to latest version (#1993426) 2021-08-13 17:59:24 -04:00
6 changed files with 141 additions and 31 deletions

4
.gitignore vendored
View File

@@ -64,3 +64,7 @@ matplotlib-1.0.0-without-gpc.tar.gz
/matplotlib-3.4.1.tar.gz
/matplotlib-3.4.1-with-freetype-2.10.4.tar.gz
/matplotlib-3.4.2.tar.gz
/matplotlib-3.4.1-with-freetype-2.11.0.tar.gz
/matplotlib-3.4.3.tar.gz
/matplotlib-3.4.3-with-freetype-2.10.4.tar.gz
/matplotlib-3.4.3-with-freetype-2.11.0.tar.gz

View File

@@ -0,0 +1,45 @@
From edf0b7412cd5cdf6e07f035d542c93033c374b37 Mon Sep 17 00:00:00 2001
From: Thomas A Caswell <tcaswell@gmail.com>
Date: Fri, 1 Apr 2022 11:46:32 -0400
Subject: [PATCH] FIX: account for constant deprecations in Pillow 9.1
https://pillow.readthedocs.io/en/stable/deprecations.html#constants
https://pillow.readthedocs.io/en/stable/releasenotes/9.1.0.html#constants
Image.None -> Image.Dither.None
Image.ADAPTIVE -> Image.Palette.ADAPTIVE
(cherry picked from commit bb997708c08dae01ac95104f1f33d8c08c4715d4)
---
lib/matplotlib/backends/backend_pdf.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py
index 26a12764da..fa7d4a0075 100644
--- a/lib/matplotlib/backends/backend_pdf.py
+++ b/lib/matplotlib/backends/backend_pdf.py
@@ -1646,8 +1646,19 @@ end"""
# Convert to indexed color if there are 256 colors or fewer
# This can significantly reduce the file size
num_colors = len(img_colors)
- img = img.convert(mode='P', dither=Image.NONE,
- palette=Image.ADAPTIVE, colors=num_colors)
+ # These constants were converted to IntEnums and deprecated in
+ # Pillow 9.2
+ dither = (
+ Image.Dither.NONE if hasattr(Image, 'Dither')
+ else Image.NONE
+ )
+ pmode = (
+ Image.Palette.ADAPTIVE if hasattr(Image, 'Palette')
+ else Image.ADAPTIVE
+ )
+ img = img.convert(
+ mode='P', dither=dither, palette=pmode, colors=num_colors
+ )
png_data, bit_depth, palette = self._writePng(img)
if bit_depth is None or palette is None:
raise RuntimeError("invalid PNG header")
--
2.39.2

View File

@@ -1,7 +1,7 @@
From 92b11ded669267100e3c6858578351cad3749cd0 Mon Sep 17 00:00:00 2001
From 60ab4094d885067c50694d2f11cd640dc5c0f0c6 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 27 Sep 2017 19:35:59 -0400
Subject: [PATCH 1/3] matplotlibrc path search fix
Subject: [PATCH 1/2] matplotlibrc path search fix
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
@@ -9,20 +9,20 @@ Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
index c3d4aaf62d..ec115cd3f5 100644
index 71c68a3d6b..88be8e97b0 100644
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
@@ -471,7 +471,8 @@ def get_cachedir():
@@ -473,7 +473,8 @@ def get_cachedir():
@_logged_cached('matplotlib data path: %s')
def get_data_path():
"""Return the path to Matplotlib data."""
- return str(Path(__file__).with_name("mpl-data"))
+ return (Path(__file__).parent.parent.parent.parent.parent /
+ 'share/matplotlib/mpl-data')
+ return str(Path(__file__).parent.parent.parent.parent.parent /
+ 'share/matplotlib/mpl-data')
def matplotlib_fname():
@@ -491,6 +492,7 @@ def matplotlib_fname():
@@ -493,6 +494,7 @@ def matplotlib_fname():
is not defined)
- On other platforms,
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
@@ -30,7 +30,7 @@ index c3d4aaf62d..ec115cd3f5 100644
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
exist.
"""
@@ -509,6 +511,7 @@ def matplotlib_fname():
@@ -511,6 +513,7 @@ def matplotlib_fname():
yield matplotlibrc
yield os.path.join(matplotlibrc, 'matplotlibrc')
yield os.path.join(get_configdir(), 'matplotlibrc')
@@ -39,5 +39,5 @@ index c3d4aaf62d..ec115cd3f5 100644
for fname in gen_candidates():
--
2.29.2
2.31.1

View File

@@ -1,23 +1,24 @@
From c970ba953bed9df6670d28cb4421ebd054033590 Mon Sep 17 00:00:00 2001
From 7ca8afa7fa3e141464c1ef2b2c58b23b586bf310 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 14 Feb 2020 06:05:42 -0500
Subject: [PATCH 2/3] Set FreeType version to 2.10.4 and update tolerances.
Subject: [PATCH 2/2] Set FreeType version to 2.10.4 and update tolerances.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/matplotlib/__init__.py | 2 +-
lib/matplotlib/tests/test_axes.py | 4 ++--
lib/matplotlib/tests/test_constrainedlayout.py | 2 +-
lib/matplotlib/tests/test_mathtext.py | 7 +++++--
lib/matplotlib/tests/test_polar.py | 2 +-
lib/matplotlib/tests/test_tightlayout.py | 10 +++++-----
setupext.py | 6 +++++-
6 files changed, 15 insertions(+), 11 deletions(-)
setupext.py | 9 ++++++++-
7 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
index ec115cd3f5..47c315bde4 100644
index 88be8e97b0..22dc74181e 100644
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
@@ -1128,7 +1128,7 @@ default_test_modules = [
@@ -1137,7 +1137,7 @@ default_test_modules = [
def _init_tests():
# The version of FreeType to install locally for running the
# tests. This must match the value in `setupext.py`
@@ -27,10 +28,10 @@ index ec115cd3f5..47c315bde4 100644
from matplotlib import ft2font
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
index ed76af576f..f432713680 100644
index 7950e5b830..046dbbe1b8 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -6426,7 +6426,7 @@ def test_normal_axes():
@@ -6500,7 +6500,7 @@ def test_normal_axes():
]
for nn, b in enumerate(bbaxis):
targetbb = mtransforms.Bbox.from_bounds(*target[nn])
@@ -39,7 +40,7 @@ index ed76af576f..f432713680 100644
target = [
[150.0, 119.999, 930.0, 11.111],
@@ -6444,7 +6444,7 @@ def test_normal_axes():
@@ -6518,7 +6518,7 @@ def test_normal_axes():
target = [85.5138, 75.88888, 1021.11, 1017.11]
targetbb = mtransforms.Bbox.from_bounds(*target)
@@ -49,7 +50,7 @@ index ed76af576f..f432713680 100644
# test that get_position roundtrips to get_window_extent
axbb = ax.get_position().transformed(fig.transFigure).bounds
diff --git a/lib/matplotlib/tests/test_constrainedlayout.py b/lib/matplotlib/tests/test_constrainedlayout.py
index 67474628e7..d3e9d105dc 100644
index 117b221cc2..d009912dfa 100644
--- a/lib/matplotlib/tests/test_constrainedlayout.py
+++ b/lib/matplotlib/tests/test_constrainedlayout.py
@@ -429,7 +429,7 @@ def test_hidden_axes():
@@ -61,8 +62,39 @@ index 67474628e7..d3e9d105dc 100644
def test_colorbar_align():
diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py
index b5fd906d2f..8e3801a231 100644
--- a/lib/matplotlib/tests/test_mathtext.py
+++ b/lib/matplotlib/tests/test_mathtext.py
@@ -1,5 +1,6 @@
import io
import os
+import platform
import re
import numpy as np
@@ -189,7 +190,8 @@ def baseline_images(request, fontset, index, text):
@pytest.mark.parametrize(
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
@pytest.mark.parametrize('baseline_images', ['mathtext'], indirect=True)
-@image_comparison(baseline_images=None)
+@image_comparison(baseline_images=None,
+ tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0)
def test_mathtext_rendering(baseline_images, fontset, index, text):
mpl.rcParams['mathtext.fontset'] = fontset
fig = plt.figure(figsize=(5.25, 0.75))
@@ -213,7 +215,8 @@ def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text):
@pytest.mark.parametrize(
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
@pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True)
-@image_comparison(baseline_images=None, extensions=['png'])
+@image_comparison(baseline_images=None, extensions=['png'],
+ tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0)
def test_mathfont_rendering(baseline_images, fontset, index, text):
mpl.rcParams['mathtext.fontset'] = fontset
fig = plt.figure(figsize=(5.25, 0.75))
diff --git a/lib/matplotlib/tests/test_polar.py b/lib/matplotlib/tests/test_polar.py
index 389d08b6ee..865780bf62 100644
index c614eff027..daf4e26fb8 100644
--- a/lib/matplotlib/tests/test_polar.py
+++ b/lib/matplotlib/tests/test_polar.py
@@ -312,7 +312,7 @@ def test_get_tightbbox_polar():
@@ -97,10 +129,10 @@ index 23d363b508..e94c863477 100644
diff --git a/setupext.py b/setupext.py
index d8d0b6b393..aabb7ed9fd 100644
index d8d0b6b393..e44d3b046a 100644
--- a/setupext.py
+++ b/setupext.py
@@ -167,12 +167,16 @@ _freetype_hashes = {
@@ -167,12 +167,18 @@ _freetype_hashes = {
'955e17244e9b38adb0c98df66abb50467312e6bb70eac07e49ce6bd1a20e809a',
'2.10.1':
'3a60d391fd579440561bf0e7f31af2222bc610ad6ce4d9d7bd2165bca8669110',
@@ -108,6 +140,8 @@ index d8d0b6b393..aabb7ed9fd 100644
+ 'e09aa914e4f7a5d723ac381420949c55c0b90b15744adce5d1406046022186ab',
+ '2.10.4':
+ '5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac',
+ '2.11.0':
+ 'a45c6b403413abd5706f3582f04c8339d26397c4304b78fa552f2215df64101f',
}
# This is the version of FreeType to use when building a local
# version. It must match the value in
@@ -118,6 +152,14 @@ index d8d0b6b393..aabb7ed9fd 100644
LOCAL_FREETYPE_HASH = _freetype_hashes.get(LOCAL_FREETYPE_VERSION, 'unknown')
LOCAL_QHULL_VERSION = '2020.2'
@@ -565,6 +571,7 @@ class FreeType(SetupPackage):
ext.extra_objects.insert(
0, str(src_path / 'objs' / '.libs' / libfreetype))
ext.define_macros.append(('FREETYPE_BUILD_TYPE', 'local'))
+ ext.libraries.append('brotlidec')
def do_custom_build(self, env):
# We're using a system freetype
--
2.29.2
2.31.1

View File

@@ -10,8 +10,8 @@
%bcond_without qt4
%endif
# No WX for EL8/ELN/EL9
%if 0%{?rhel} >= 8
# No WX for EL8
%if 0%{?rhel} == 8
%bcond_with wx
%else
%bcond_without wx
@@ -41,15 +41,15 @@
%global _docdir_fmt %{name}
# Updated test images for new FreeType.
%global mpl_images_version 3.4.1
%global mpl_images_version 3.4.3
# The version of FreeType in this Fedora branch.
%global ftver 2.10.4
Name: python-matplotlib
Version: 3.4.2
%global Version 3.4.2
Release: 1%{?dist}
Version: 3.4.3
%global Version 3.4.3
Release: 4%{?dist}
Summary: Python 2D plotting library
# qt4_editor backend is MIT
# ResizeObserver at end of lib/matplotlib/backends/web_backend/js/mpl.js is Public Domain
@@ -58,6 +58,10 @@ URL: http://matplotlib.org
Source0: https://github.com/matplotlib/matplotlib/archive/v%{Version}/matplotlib-%{Version}.tar.gz
Source1: setup.cfg
# Upstream backported patches
# https://github.com/matplotlib/matplotlib/commit/bb997708c08dae01ac95104f1f33d8c08c4715d4
Patch1: 0001-FIX-account-for-constant-deprecations-in-Pillow-9.1.patch
# Fedora-specific patches; see:
# https://github.com/fedora-python/matplotlib/tree/fedora-patches
# Updated test images for new FreeType.
@@ -312,6 +316,9 @@ Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
%prep
%autosetup -n matplotlib-%{Version} -N
# Upstream backported patches
%patch1 -p1
# Fedora-specific patches follow:
%patch1001 -p1
# Updated test images for new FreeType.
@@ -463,6 +470,18 @@ PYTHONDONTWRITEBYTECODE=1 \
%changelog
* Sun Jul 16 2023 Orion Poplawski <orion@nwra.com> - 3.4.3-4
- Re-enable wx support (bz#2211203)
* Sat Apr 15 2023 Carl George <carl@george.computer> - 3.4.3-3
- Fix compatibility with Pillow 9.1
* Wed Aug 25 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.4.3-2
- Fix return type in get_data_path patch
* Fri Aug 13 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.4.3-1
- Update to latest version (#1993426)
* Sat May 08 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.4.2-1
- Update to latest version (#1958461)

View File

@@ -1,2 +1,2 @@
SHA512 (matplotlib-3.4.2.tar.gz) = 9f285fd828c543c0fe424fec332bac65d56b9df8be400911546975af9185d703c19d18acab2fe042450b51c9f3bb32e714994603070cdb7470097382f1727d8d
SHA512 (matplotlib-3.4.1-with-freetype-2.10.4.tar.gz) = 37d665e7120fc842e41e2b94b27c42e3e14d1f0a3ff27c8672e5eb3be6c2e68bb7882aea61383ebab324dcbc11b1c2df3b8d0aba77be83a241186aa1e79a3350
SHA512 (matplotlib-3.4.3.tar.gz) = e346c7d0f33b7d2fb5b48a4578ec99a40c2e5b959d109526ccbe7582a37f10abb91d53062711c37eb4ccaf462fd8684e1557405c50ccf43139bc371601a60e80
SHA512 (matplotlib-3.4.3-with-freetype-2.10.4.tar.gz) = 665870e9c34fa562c69c28432b6d378e02c63ff2b14a34f982a16c89ecdb3b012cdf3306e84a052d689710f2ddff069c8a207b63971c73e5c867d6562e1f6241