From: Theo Buehler Subject: piglit: fix build with numpy 2.4.0 To: ports@openbsd.org Cc: jsg@openbsd.org Date: Wed, 7 Jan 2026 15:30:56 +0100 Fix the build of piglit with numpy 2.4.0 which removed newshape and the compat glue assigning it to shape. The build fails with: File "/work/pobj/piglit-20250507/piglit-20250507/generated_tests/builtin_function.py", line 296 , in column_major_values return list(np.reshape(value, newshape=-1, order='F')) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: reshape() got an unexpected keyword argument 'newshape' Fix this and a similar problem in the fp64 variant. This also builds with in-tree py3-numpy-2.2.6p2. Since upstream piglit pinned numpy to 1, they don't have such a fix (and they would probably need to drop the 'shape=' part of the diffs) Index: Makefile =================================================================== RCS file: /cvs/ports/graphics/piglit/Makefile,v diff -u -p -r1.27 Makefile --- Makefile 20 May 2025 12:10:50 -0000 1.27 +++ Makefile 7 Jan 2026 14:18:50 -0000 @@ -2,7 +2,7 @@ COMMENT = automated OpenGL and OpenCL te ONLY_FOR_ARCHS = amd64 i386 DISTNAME = piglit-20250507 -REVISION = 0 +REVISION = 1 DIST_TUPLE = fdo mesa piglit 1767af745ed96f77b16c0c205015366d1fbbdb22 ${WRKDIST}/ Index: patches/patch-generated_tests_builtin_function_fp64_py =================================================================== RCS file: patches/patch-generated_tests_builtin_function_fp64_py diff -N patches/patch-generated_tests_builtin_function_fp64_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-generated_tests_builtin_function_fp64_py 7 Jan 2026 13:39:21 -0000 @@ -0,0 +1,26 @@ +TypeError: reshape() got an unexpected keyword argument 'newshape' + +The newshape parameter was deprecated in NumPy 2.1.0 and has been removed from +numpy.reshape. Pass it positionally or use shape= on newer NumPy versions. + +Index: generated_tests/builtin_function_fp64.py +--- generated_tests/builtin_function_fp64.py.orig ++++ generated_tests/builtin_function_fp64.py +@@ -254,7 +254,7 @@ 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')) ++ return list(np.reshape(value, shape=-1, order='F')) + else: + return [value] + +@@ -262,7 +262,7 @@ 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') ++ column_major = np.reshape(np.array(value), shape=-1, order='F') + if column_major.dtype == bool: + values = ['true' if x else 'false' for x in column_major] + else: Index: patches/patch-generated_tests_builtin_function_py =================================================================== RCS file: patches/patch-generated_tests_builtin_function_py diff -N patches/patch-generated_tests_builtin_function_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-generated_tests_builtin_function_py 7 Jan 2026 13:39:21 -0000 @@ -0,0 +1,26 @@ +TypeError: reshape() got an unexpected keyword argument 'newshape' + +The newshape parameter was deprecated in NumPy 2.1.0 and has been removed from +numpy.reshape. Pass it positionally or use shape= on newer NumPy versions. + +Index: generated_tests/builtin_function.py +--- generated_tests/builtin_function.py.orig ++++ generated_tests/builtin_function.py +@@ -293,7 +293,7 @@ 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')) ++ return list(np.reshape(value, shape=-1, order='F')) + else: + return [value] + +@@ -301,7 +301,7 @@ 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') ++ column_major = np.reshape(np.array(value), shape=-1, order='F') + if column_major.dtype == bool: + values = ['true' if x else 'false' for x in column_major] + elif column_major.dtype == np.int64: