Sync from SUSE:SLFO:Main python-matplotlib revision 5973b7db62f00b395e3f823b4ef4fa9c

This commit is contained in:
2025-07-18 11:39:54 +02:00
parent 898f207e02
commit 623e72193b
3 changed files with 43 additions and 0 deletions

36
Pillow-13-compat.patch Normal file
View File

@@ -0,0 +1,36 @@
From 0b2fa3f952b6b97a121a3d7f05a0753b52b802cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= <cr52@protonmail.com>
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:

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jul 3 07:36:25 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
- Add Pillow-13-compat.patch to fix tests with new Pillow version
-------------------------------------------------------------------
Mon Jun 9 15:35:10 UTC 2025 - Ben Greiner <code@bnavigator.de>

View File

@@ -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