diff --git a/Pillow-13-compat.patch b/Pillow-13-compat.patch new file mode 100644 index 0000000..d7eb1d5 --- /dev/null +++ b/Pillow-13-compat.patch @@ -0,0 +1,36 @@ +From 0b2fa3f952b6b97a121a3d7f05a0753b52b802cc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= +Date: Sat, 28 Jun 2025 11:39:49 +0200 +Subject: [PATCH] BUG: fix future incompatibility with Pillow 13 + +--- + lib/matplotlib/backends/_backend_tk.py | 2 +- + lib/matplotlib/backends/backend_pdf.py | 2 ++- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py +index 0bbff1379ffa..eaf868fd8bec 100644 +--- a/lib/matplotlib/backends/_backend_tk.py ++++ b/lib/matplotlib/backends/_backend_tk.py +@@ -775,7 +775,7 @@ def _recolor_icon(image, color): + image_data = np.asarray(image).copy() + black_mask = (image_data[..., :3] == 0).all(axis=-1) + image_data[black_mask, :3] = color +- return Image.fromarray(image_data, mode="RGBA") ++ return Image.fromarray(image_data) + + # Use the high-resolution (48x48 px) icon if it exists and is needed + with Image.open(path_large if (size > 24 and path_large.exists()) +diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py +index f20bdffd4a3a..4429dc9ba707 100644 +--- a/lib/matplotlib/backends/backend_pdf.py ++++ b/lib/matplotlib/backends/backend_pdf.py +@@ -1784,7 +1784,7 @@ def _writeImg(self, data, id, smask=None): + data[:, :, 2]) + indices = np.argsort(palette24).astype(np.uint8) + rgb8 = indices[np.searchsorted(palette24, rgb24, sorter=indices)] +- img = Image.fromarray(rgb8, mode='P') ++ img = Image.fromarray(rgb8).convert("P") + img.putpalette(palette) + png_data, bit_depth, palette = self._writePng(img) + if bit_depth is None or palette is None: diff --git a/python-matplotlib.changes b/python-matplotlib.changes index 6500e18..d99ec4e 100644 --- a/python-matplotlib.changes +++ b/python-matplotlib.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jul 3 07:36:25 UTC 2025 - Nico Krapp + +- Add Pillow-13-compat.patch to fix tests with new Pillow version + ------------------------------------------------------------------- Mon Jun 9 15:35:10 UTC 2025 - Ben Greiner diff --git a/python-matplotlib.spec b/python-matplotlib.spec index 6719d0c..c94ff10 100644 --- a/python-matplotlib.spec +++ b/python-matplotlib.spec @@ -59,6 +59,8 @@ Source99: https://downloads.sourceforge.net/project/freetype/freetype2/2.6 Source100: python-matplotlib.rpmlintrc # PATCH-FEATURE-OPENSUSE matplotlib-meson-options-opensuse.patch code@bnavigator.de -- Custom build options for meson-python Patch1: matplotlib-meson-options-opensuse.patch +# PATCH-FIX-UPSTREAM Pillow-13-compat.patch https://github.com/matplotlib/matplotlib/pull/30221 +Patch2: Pillow-13-compat.patch Recommends: ghostscript Recommends: libxml2-tools Recommends: poppler-tools