From 35a74261e31a18046580c5bd0afafab066d2b63c Mon Sep 17 00:00:00 2001 From: John Date: Wed, 20 Aug 2025 15:46:37 +0200 Subject: [PATCH] mypaint: import patch to fix compatibility with numpy 2.3 closes #56836 --- ...python-3.11.patch => 01-python-3.11.patch} | 0 srcpkgs/mypaint/patches/02-numpy.patch | 32 ++++++++++++++++ srcpkgs/mypaint/patches/03-numpy.patch | 37 +++++++++++++++++++ srcpkgs/mypaint/template | 2 +- 4 files changed, 70 insertions(+), 1 deletion(-) rename srcpkgs/mypaint/patches/{python-3.11.patch => 01-python-3.11.patch} (100%) create mode 100644 srcpkgs/mypaint/patches/02-numpy.patch create mode 100644 srcpkgs/mypaint/patches/03-numpy.patch diff --git a/srcpkgs/mypaint/patches/python-3.11.patch b/srcpkgs/mypaint/patches/01-python-3.11.patch similarity index 100% rename from srcpkgs/mypaint/patches/python-3.11.patch rename to srcpkgs/mypaint/patches/01-python-3.11.patch diff --git a/srcpkgs/mypaint/patches/02-numpy.patch b/srcpkgs/mypaint/patches/02-numpy.patch new file mode 100644 index 00000000000..0811338960a --- /dev/null +++ b/srcpkgs/mypaint/patches/02-numpy.patch @@ -0,0 +1,32 @@ +From 2a92b6baf452aba2cff3cc0a7782b301da3933d7 Mon Sep 17 00:00:00 2001 +From: Jan Tojnar +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 diff --git a/srcpkgs/mypaint/patches/03-numpy.patch b/srcpkgs/mypaint/patches/03-numpy.patch new file mode 100644 index 00000000000..4b03a443d3b --- /dev/null +++ b/srcpkgs/mypaint/patches/03-numpy.patch @@ -0,0 +1,37 @@ +From ab017e073e83a4930a0fb09608682bf4b7ab1874 Mon Sep 17 00:00:00 2001 +From: askmeaboutlo0m +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 + diff --git a/srcpkgs/mypaint/template b/srcpkgs/mypaint/template index 72a2d22602e..fd44dfa4e16 100644 --- a/srcpkgs/mypaint/template +++ b/srcpkgs/mypaint/template @@ -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"