mypaint: import patch to fix compatibility with numpy 2.3

closes #56836
This commit is contained in:
John 2025-08-20 15:46:37 +02:00
parent 4ea3982afb
commit 35a74261e3
4 changed files with 70 additions and 1 deletions

View file

@ -0,0 +1,32 @@
From 2a92b6baf452aba2cff3cc0a7782b301da3933d7 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Sun, 4 Aug 2024 05:41:28 +0200
Subject: [PATCH] strokemap: Replace deprecated tostring with tobytes
https: //numpy.org/devdocs/reference/generated/numpy.ndarray.tostring.html#numpy.ndarray.tostring
---
lib/strokemap.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/strokemap.py b/lib/strokemap.py
index f279edf84..59b26676f 100644
--- a/lib/strokemap.py
+++ b/lib/strokemap.py
@@ -411,7 +411,7 @@
"""
- _ZDATA_ONES = zlib.compress(np.ones((N, N), 'uint8').tostring())
+ _ZDATA_ONES = zlib.compress(np.ones((N, N), 'uint8').tobytes())
def __init__(self):
"""Initialize, as a tile filled with all ones."""
@@ -451,7 +451,7 @@
tile._zdata = None
else:
tile._all = False
- tile._zdata = zlib.compress(array.tostring())
+ tile._zdata = zlib.compress(array.tobytes())
return tile
@classmethod

View file

@ -0,0 +1,37 @@
From ab017e073e83a4930a0fb09608682bf4b7ab1874 Mon Sep 17 00:00:00 2001
From: askmeaboutlo0m <askmeaboutlo0m@users.noreply.github.com>
Date: Mon, 23 Jun 2025 15:51:28 +0200
Subject: [PATCH] Replace tostring() with tobytes() in stroke.py (#1300)
Because numpy removed the former function (in a minor release) with
numpy/numpy#28254. The function was an alias, so there's no change in
behavior, i.e. it always returned bytes.
See also 2a92b6baf452aba2cff3cc0a7782b301da3933d7, where the same
function was already replaced in strokemap.py.
---
lib/stroke.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/stroke.py b/lib/stroke.py
index 8024e2f4f..a1fc94579 100644
--- a/lib/stroke.py
+++ b/lib/stroke.py
@@ -43,7 +43,7 @@
states = brush.get_states_as_array()
assert states.dtype == 'float32'
- self.brush_state = states.tostring()
+ self.brush_state = states.tobytes()
self.brush = brush
self.brush.new_stroke() # resets the stroke_* members of the brush
@@ -63,7 +63,7 @@
# - for space: just gzip? use integer datatypes?
# - for time: maybe already use array storage while recording?
data = np.array(self.tmp_event_list, dtype='float64')
- data = data.tostring()
+ data = data.tobytes()
version = b'2'
self.stroke_data = version + data

View file

@ -1,7 +1,7 @@
# Template file for 'mypaint'
pkgname=mypaint
version=2.0.1
revision=7
revision=8
build_style=python3-module
pycompile_dirs="/usr/share/mypaint"
hostmakedepends="swig pkg-config gettext python3-setuptools python3-numpy python3"