From: Wang Mingyu <[email protected]>

Signed-off-by: Wang Mingyu <[email protected]>
---
 ...use-shape-in-place-of-newshape-on-nu.patch | 105 ++++++++++++++++++
 meta/recipes-graphics/piglit/piglit_git.bb    |   1 +
 2 files changed, 106 insertions(+)
 create mode 100644 
meta/recipes-graphics/piglit/piglit/0001-generated_tests-use-shape-in-place-of-newshape-on-nu.patch

diff --git 
a/meta/recipes-graphics/piglit/piglit/0001-generated_tests-use-shape-in-place-of-newshape-on-nu.patch
 
b/meta/recipes-graphics/piglit/piglit/0001-generated_tests-use-shape-in-place-of-newshape-on-nu.patch
new file mode 100644
index 0000000000..acf2671262
--- /dev/null
+++ 
b/meta/recipes-graphics/piglit/piglit/0001-generated_tests-use-shape-in-place-of-newshape-on-nu.patch
@@ -0,0 +1,105 @@
+From ad6ee4d7c4d3b882ef6196832ed2bbc78b7cb10a Mon Sep 17 00:00:00 2001
+From: Wang Mingyu <[email protected]>
+Date: Wed, 11 Feb 2026 03:42:24 +0000
+Subject: [PATCH] generated_tests: use 'shape' in place of 'newshape' on
+ numpy>=2.1
+
+The 'newshape' parameter was deprecated upstream but kept for backwards
+compatibility reasons. It was finally removed as of numpy 2.4.0, so
+transition to using 'shape' in its place when available.
+
+Upstream-Status: Backport 
[https://gitlab.freedesktop.org/mesa/piglit/-/commit/c1dd58ff61fe6b713af795e2680c16371c1cb98c]
+
+Signed-off-by: Wang Mingyu <[email protected]>
+---
+ generated_tests/builtin_function.py      | 17 +++++++++++++++--
+ generated_tests/builtin_function_fp64.py | 17 +++++++++++++++--
+ 2 files changed, 30 insertions(+), 4 deletions(-)
+
+diff --git a/generated_tests/builtin_function.py 
b/generated_tests/builtin_function.py
+index eb7e078..f87236f 100644
+--- a/generated_tests/builtin_function.py
++++ b/generated_tests/builtin_function.py
+@@ -58,6 +58,11 @@ import numpy as np
+ if np.lib.NumpyVersion(np.__version__) >= '2.0.0b1':
+     np.set_printoptions(legacy = "1.25")
+ 
++if np.lib.NumpyVersion(np.__version__) >= '2.1.0':
++    np_reshape_shape = 'shape'
++else:
++    np_reshape_shape = 'newshape'
++
+ # Floating point types used by Python and numpy
+ FLOATING_TYPES = (float, np.float64, np.float32)
+ 
+@@ -293,7 +298,11 @@ def column_major_values(value):
+     """Given a native numpy value, return a list of the scalar values
+     comprising it, in column-major order."""
+     if isinstance(value, np.ndarray):
+-        return list(np.reshape(value, newshape=-1, order='F'))
++        reshape_args = {
++            np_reshape_shape: -1,
++            'order': 'F',
++        }
++        return list(np.reshape(value, **reshape_args))
+     else:
+         return [value]
+ 
+@@ -301,7 +310,11 @@ def column_major_values(value):
+ def glsl_constant(value):
+     """Given a native numpy value, return GLSL code that constructs
+     it."""
+-    column_major = np.reshape(np.array(value), newshape=-1, order='F')
++    reshape_args = {
++        np_reshape_shape: -1,
++        'order': 'F',
++    }
++    column_major = np.reshape(np.array(value), **reshape_args)
+     if column_major.dtype == bool:
+         values = ['true' if x else 'false' for x in column_major]
+     elif column_major.dtype == np.int64:
+diff --git a/generated_tests/builtin_function_fp64.py 
b/generated_tests/builtin_function_fp64.py
+index 84d939c..06fe987 100644
+--- a/generated_tests/builtin_function_fp64.py
++++ b/generated_tests/builtin_function_fp64.py
+@@ -57,6 +57,11 @@ import numpy as np
+ if np.lib.NumpyVersion(np.__version__) >= '2.0.0b1':
+     np.set_printoptions(legacy = "1.25")
+ 
++if np.lib.NumpyVersion(np.__version__) >= '2.1.0':
++    np_reshape_shape = 'shape'
++else:
++    np_reshape_shape = 'newshape'
++
+ # Floating point types used by Python and numpy
+ DOUBLE_TYPES = (float, np.float64, np.float32)
+ 
+@@ -254,7 +259,11 @@ def column_major_values(value):
+     """Given a native numpy value, return a list of the scalar values
+     comprising it, in column-major order."""
+     if isinstance(value, np.ndarray):
+-        return list(np.reshape(value, newshape=-1, order='F'))
++        reshape_args = {
++            np_reshape_shape: -1,
++            'order': 'F',
++        }
++        return list(np.reshape(value, **reshape_args))
+     else:
+         return [value]
+ 
+@@ -262,7 +271,11 @@ def column_major_values(value):
+ def glsl_constant(value):
+     """Given a native numpy value, return GLSL code that constructs
+     it."""
+-    column_major = np.reshape(np.array(value), newshape=-1, order='F')
++    reshape_args = {
++        np_reshape_shape: -1,
++        'order': 'F',
++    }
++    column_major = np.reshape(np.array(value), **reshape_args)
+     if column_major.dtype == bool:
+         values = ['true' if x else 'false' for x in column_major]
+     else:
+-- 
+2.43.0
+
diff --git a/meta/recipes-graphics/piglit/piglit_git.bb 
b/meta/recipes-graphics/piglit/piglit_git.bb
index 060e287f26..7659635062 100644
--- a/meta/recipes-graphics/piglit/piglit_git.bb
+++ b/meta/recipes-graphics/piglit/piglit_git.bb
@@ -13,6 +13,7 @@ SRC_URI = 
"git://gitlab.freedesktop.org/mesa/piglit.git;protocol=https;branch=ma
            
file://0001-CMakeLists.txt-do-not-obtain-wayland-scanner-path-fr.patch \
            
file://0001-tests-egl-spec-make-egl_ext_surface_compression-cond.patch \
            file://0001-tests-no_error.py-modify-_command-and-not-command.patch 
\
+           
file://0001-generated_tests-use-shape-in-place-of-newshape-on-nu.patch \
            "
 UPSTREAM_CHECK_COMMITS = "1"
 
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#230961): 
https://lists.openembedded.org/g/openembedded-core/message/230961
Mute This Topic: https://lists.openembedded.org/mt/117751538/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to