diff --git a/.github/workflows/build-xtgeo.yml b/.github/workflows/build-xtgeo.yml index fd1df4aaadb2..c2930f1ecf93 100644 --- a/.github/workflows/build-xtgeo.yml +++ b/.github/workflows/build-xtgeo.yml @@ -97,6 +97,9 @@ jobs: PIP_ONLY_BINARY=numpy,pandas,scipy,pyarrow,h5py,hdf5plugin,matplotlib,segyio,shapely,pillow SETUPTOOLS_SCM_PRETEND_VERSION_FOR_XTGEO=${{ env.XTGEO_VERSION }} CIBW_TEST_EXTRAS: dev + # pytest-benchmark's fixture reads Function._nodeid, which pytest 9.2 removed, so + # every benchmark test errors at setup; stay on the pytest 9.1 series. + CIBW_TEST_REQUIRES: pytest<9.2 CIBW_BEFORE_TEST: >- pushd {package} && git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata || true diff --git a/docs/packages/xtgeo.yaml b/docs/packages/xtgeo.yaml index 97d823efbddb..0baeb8ef9298 100644 --- a/docs/packages/xtgeo.yaml +++ b/docs/packages/xtgeo.yaml @@ -15,3 +15,5 @@ versions: - filename: xtgeo-4.25.1-cp314-cp314-manylinux_2_39_riscv64.whl sha256: 703bc84302d2072954bafa7408df138b32db75cbaf4e15ce454f66fdbf191b10 requires-python: '>=3.11' +- version: 4.26.0 +- version: 4.27.0 diff --git a/patches/xtgeo/4.26.0/0001-unpin-swig-for-riscv64.patch b/patches/xtgeo/4.26.0/0001-unpin-swig-for-riscv64.patch new file mode 100644 index 000000000000..0709ec188a17 --- /dev/null +++ b/patches/xtgeo/4.26.0/0001-unpin-swig-for-riscv64.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Tue, 13 Oct 2026 07:54:08 +0000 +Subject: [PATCH] unpin swig for riscv64 + +pyproject.toml's build-system.requires pins "swig<4.3.0". PyPI's swig +package only started publishing manylinux_riscv64 wheels at 4.3.1.post0, +so pip falls back to building swig itself from its sdist on riscv64 for +no reason that applies to this build: the pin (commit 839503b) exists to +avoid a SWIG 4.3.0 numpy.i regression that segfaulted under Python 3.8 + +pandas>2, and this release already requires Python >=3.11. + +Drop the pin so pip resolves swig 4.5.1, which ships a riscv64 wheel. + +Upstream-Status: Inappropriate [riscv64-only infra constraint; the pin's own Python 3.8 rationale no longer applies to this release] + +Signed-off-by: Ludovic Henry +--- + pyproject.toml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 718ff67..5b6f1cc 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -3,7 +3,7 @@ requires = [ + "numpy>=2.0.0", + "pybind11", + "scikit-build-core[pyproject]>=0.10", +- "swig<4.3.0", ++ "swig", + ] + build-backend = "scikit_build_core.build" + diff --git a/patches/xtgeo/4.26.0/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch b/patches/xtgeo/4.26.0/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch new file mode 100644 index 000000000000..ee2c36a27240 --- /dev/null +++ b/patches/xtgeo/4.26.0/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch @@ -0,0 +1,379 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Tue, 13 Oct 2026 08:08:08 +0000 +Subject: [PATCH] fix numpy.i for SWIG >=4.3's 3-arg SWIG_Python_AppendOutput + +SWIG 4.3.0 added an `is_void` third parameter to its generated +SWIG_Python_AppendOutput() runtime helper (pyrun.swg). xtgeo's own +project-local src/lib/numpy.i still calls it with the pre-4.3 two-arg +form in every ARGOUT_ARRAY* typemap, so building with any SWIG >=4.3 +fails with "too few arguments to function 'SWIG_Python_AppendOutput'" +-- reproduces on any arch, this host included. + +Call SWIG's SWIG_AppendOutput() macro instead, as numpy's own current +tools/swig/numpy.i does. SWIG >=4.3 defines it as +SWIG_Python_AppendOutput(result, obj, $isvoid) and older SWIG as the +two-arg call, so it builds with any version. $isvoid matters: the +helper only replaces a Py_None result when is_void is set, and a void +C function's result starts as Py_None, so a hardcoded 0 would make +every void function with ARGOUT arrays (grdcp3d_get_vtk_grid_arrays) +return [None, a, b, c] instead of the pre-4.3 [a, b, c]. + +This is required independently of which SWIG >=4.3 is used: swig<4.3 +has no riscv64 wheel on PyPI (gotcha territory -- see the companion +0001 patch, which drops that pin), and 4.3.1.post0 (the first riscv64 +release) hits this same error. + +Upstream-Status: Inappropriate [riscv64 needs SWIG>=4.3.1.post0 for a PyPI wheel; this project-local numpy.i was never updated for SWIG 4.3's runtime signature change] + +Signed-off-by: Ludovic Henry +--- + src/lib/numpy.i | 76 ++++++++++++++++++++++++------------------------- + 1 file changed, 38 insertions(+), 38 deletions(-) + +diff --git a/src/lib/numpy.i b/src/lib/numpy.i +index b8fdaeb..60eb016 100644 +--- a/src/lib/numpy.i ++++ b/src/lib/numpy.i +@@ -1988,7 +1988,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY1[ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) +@@ -2016,7 +2016,7 @@ + %typemap(argout) + (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) +@@ -2044,7 +2044,7 @@ + %typemap(argout) + (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) +@@ -2062,7 +2062,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) +@@ -2080,7 +2080,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY]) +@@ -2098,7 +2098,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /*****************************/ +@@ -2123,7 +2123,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) +@@ -2144,7 +2144,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2166,7 +2166,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) +@@ -2188,7 +2188,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2210,7 +2210,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) +@@ -2232,7 +2232,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2256,7 +2256,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2280,7 +2280,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2304,7 +2304,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2328,7 +2328,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2353,7 +2353,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2378,7 +2378,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2403,7 +2403,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2428,7 +2428,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /*************************************/ +@@ -2466,7 +2466,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1) +@@ -2500,7 +2500,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2535,7 +2535,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2) +@@ -2570,7 +2570,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2605,7 +2605,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2) +@@ -2640,7 +2640,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2677,7 +2677,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2714,7 +2714,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2751,7 +2751,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2788,7 +2788,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2826,7 +2826,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2864,7 +2864,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2902,7 +2902,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2940,7 +2940,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2978,7 +2978,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -3016,7 +3016,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -3054,7 +3054,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -3092,7 +3092,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /**************************************/ diff --git a/patches/xtgeo/4.26.0/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch b/patches/xtgeo/4.26.0/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch new file mode 100644 index 000000000000..e8a8cbcddff5 --- /dev/null +++ b/patches/xtgeo/4.26.0/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Fri, 23 Oct 2026 16:30:00 +0000 +Subject: [PATCH] fix numpy.i for SWIG >=4.5's removed Python 2 macros + +SWIG 4.5.0 dropped the Python 2 compatibility macros from its +pyhead.swg runtime, including PyString_Check, PyInt_Check and +PyInt_AsLong. xtgeo's project-local src/lib/numpy.i still uses those +three, so with SWIG >=4.5 the generated cxtgeoPYTHON_wrap.c calls +undeclared functions: GCC 13 only warns, and the extension then fails +to import with "undefined symbol: PyInt_AsLong"; GCC 14 rejects the +implicit declarations outright. Reproduces on any arch. + +Replace each with the exact expansion SWIG <=4.4's pyhead.swg used on +Python 3 (PyBytes_Check, PyLong_Check, PyLong_AsLong), so the generated +code is unchanged for every SWIG version. + +Needed because 0001 drops the swig<4.3.0 pin, and pip then resolves +the newest swig (4.5.1), which is the release with a riscv64 wheel. + +Upstream-Status: Inappropriate [only reachable once the swig<4.3.0 pin is dropped for riscv64; upstream's pinned SWIG still defines these macros] + +Signed-off-by: Ludovic Henry +--- + src/lib/numpy.i | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/lib/numpy.i b/src/lib/numpy.i +index 60eb016..ff3db39 100644 +--- a/src/lib/numpy.i ++++ b/src/lib/numpy.i +@@ -112,8 +112,8 @@ + if (py_obj == NULL ) return "C NULL value"; + if (py_obj == Py_None ) return "Python None" ; + if (PyCallable_Check(py_obj)) return "callable" ; +- if (PyString_Check( py_obj)) return "string" ; +- if (PyInt_Check( py_obj)) return "int" ; ++ if (PyBytes_Check( py_obj)) return "string" ; ++ if (PyLong_Check( py_obj)) return "int" ; + if (PyFloat_Check( py_obj)) return "float" ; + if (PyDict_Check( py_obj)) return "dict" ; + if (PyList_Check( py_obj)) return "list" ; +@@ -1999,7 +1999,7 @@ + (PyObject* array = NULL) + { + npy_intp dims[1]; +- if (!PyInt_Check($input)) ++ if (!PyLong_Check($input)) + { + const char* typestring = pytype_string($input); + PyErr_Format(PyExc_TypeError, +@@ -2007,7 +2007,7 @@ + typestring); + SWIG_fail; + } +- $2 = (DIM_TYPE) PyInt_AsLong($input); ++ $2 = (DIM_TYPE) PyLong_AsLong($input); + dims[0] = (npy_intp) $2; + array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); + if (!array) SWIG_fail; +@@ -2027,7 +2027,7 @@ + (PyObject* array = NULL) + { + npy_intp dims[1]; +- if (!PyInt_Check($input)) ++ if (!PyLong_Check($input)) + { + const char* typestring = pytype_string($input); + PyErr_Format(PyExc_TypeError, +@@ -2035,7 +2035,7 @@ + typestring); + SWIG_fail; + } +- $1 = (DIM_TYPE) PyInt_AsLong($input); ++ $1 = (DIM_TYPE) PyLong_AsLong($input); + dims[0] = (npy_intp) $1; + array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); + if (!array) SWIG_fail; diff --git a/patches/xtgeo/4.27.0/0001-unpin-swig-for-riscv64.patch b/patches/xtgeo/4.27.0/0001-unpin-swig-for-riscv64.patch new file mode 100644 index 000000000000..0709ec188a17 --- /dev/null +++ b/patches/xtgeo/4.27.0/0001-unpin-swig-for-riscv64.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Tue, 13 Oct 2026 07:54:08 +0000 +Subject: [PATCH] unpin swig for riscv64 + +pyproject.toml's build-system.requires pins "swig<4.3.0". PyPI's swig +package only started publishing manylinux_riscv64 wheels at 4.3.1.post0, +so pip falls back to building swig itself from its sdist on riscv64 for +no reason that applies to this build: the pin (commit 839503b) exists to +avoid a SWIG 4.3.0 numpy.i regression that segfaulted under Python 3.8 + +pandas>2, and this release already requires Python >=3.11. + +Drop the pin so pip resolves swig 4.5.1, which ships a riscv64 wheel. + +Upstream-Status: Inappropriate [riscv64-only infra constraint; the pin's own Python 3.8 rationale no longer applies to this release] + +Signed-off-by: Ludovic Henry +--- + pyproject.toml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 718ff67..5b6f1cc 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -3,7 +3,7 @@ requires = [ + "numpy>=2.0.0", + "pybind11", + "scikit-build-core[pyproject]>=0.10", +- "swig<4.3.0", ++ "swig", + ] + build-backend = "scikit_build_core.build" + diff --git a/patches/xtgeo/4.27.0/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch b/patches/xtgeo/4.27.0/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch new file mode 100644 index 000000000000..ee2c36a27240 --- /dev/null +++ b/patches/xtgeo/4.27.0/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch @@ -0,0 +1,379 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Tue, 13 Oct 2026 08:08:08 +0000 +Subject: [PATCH] fix numpy.i for SWIG >=4.3's 3-arg SWIG_Python_AppendOutput + +SWIG 4.3.0 added an `is_void` third parameter to its generated +SWIG_Python_AppendOutput() runtime helper (pyrun.swg). xtgeo's own +project-local src/lib/numpy.i still calls it with the pre-4.3 two-arg +form in every ARGOUT_ARRAY* typemap, so building with any SWIG >=4.3 +fails with "too few arguments to function 'SWIG_Python_AppendOutput'" +-- reproduces on any arch, this host included. + +Call SWIG's SWIG_AppendOutput() macro instead, as numpy's own current +tools/swig/numpy.i does. SWIG >=4.3 defines it as +SWIG_Python_AppendOutput(result, obj, $isvoid) and older SWIG as the +two-arg call, so it builds with any version. $isvoid matters: the +helper only replaces a Py_None result when is_void is set, and a void +C function's result starts as Py_None, so a hardcoded 0 would make +every void function with ARGOUT arrays (grdcp3d_get_vtk_grid_arrays) +return [None, a, b, c] instead of the pre-4.3 [a, b, c]. + +This is required independently of which SWIG >=4.3 is used: swig<4.3 +has no riscv64 wheel on PyPI (gotcha territory -- see the companion +0001 patch, which drops that pin), and 4.3.1.post0 (the first riscv64 +release) hits this same error. + +Upstream-Status: Inappropriate [riscv64 needs SWIG>=4.3.1.post0 for a PyPI wheel; this project-local numpy.i was never updated for SWIG 4.3's runtime signature change] + +Signed-off-by: Ludovic Henry +--- + src/lib/numpy.i | 76 ++++++++++++++++++++++++------------------------- + 1 file changed, 38 insertions(+), 38 deletions(-) + +diff --git a/src/lib/numpy.i b/src/lib/numpy.i +index b8fdaeb..60eb016 100644 +--- a/src/lib/numpy.i ++++ b/src/lib/numpy.i +@@ -1988,7 +1988,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY1[ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) +@@ -2016,7 +2016,7 @@ + %typemap(argout) + (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) +@@ -2044,7 +2044,7 @@ + %typemap(argout) + (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) +@@ -2062,7 +2062,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) +@@ -2080,7 +2080,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY]) +@@ -2098,7 +2098,7 @@ + %typemap(argout) + (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY]) + { +- $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); + } + + /*****************************/ +@@ -2123,7 +2123,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) +@@ -2144,7 +2144,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2166,7 +2166,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) +@@ -2188,7 +2188,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2210,7 +2210,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) +@@ -2232,7 +2232,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2256,7 +2256,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2280,7 +2280,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2304,7 +2304,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2328,7 +2328,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2353,7 +2353,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2378,7 +2378,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2403,7 +2403,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2428,7 +2428,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array || !require_fortran(array)) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /*************************************/ +@@ -2466,7 +2466,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1) +@@ -2500,7 +2500,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2535,7 +2535,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2) +@@ -2570,7 +2570,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) +@@ -2605,7 +2605,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2) +@@ -2640,7 +2640,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2677,7 +2677,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2714,7 +2714,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2751,7 +2751,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, +@@ -2788,7 +2788,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2826,7 +2826,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2864,7 +2864,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2902,7 +2902,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -2940,7 +2940,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -2978,7 +2978,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -3016,7 +3016,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, +@@ -3054,7 +3054,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, +@@ -3092,7 +3092,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_AppendOutput($result,obj); + } + + /**************************************/ diff --git a/patches/xtgeo/4.27.0/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch b/patches/xtgeo/4.27.0/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch new file mode 100644 index 000000000000..e8a8cbcddff5 --- /dev/null +++ b/patches/xtgeo/4.27.0/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Fri, 23 Oct 2026 16:30:00 +0000 +Subject: [PATCH] fix numpy.i for SWIG >=4.5's removed Python 2 macros + +SWIG 4.5.0 dropped the Python 2 compatibility macros from its +pyhead.swg runtime, including PyString_Check, PyInt_Check and +PyInt_AsLong. xtgeo's project-local src/lib/numpy.i still uses those +three, so with SWIG >=4.5 the generated cxtgeoPYTHON_wrap.c calls +undeclared functions: GCC 13 only warns, and the extension then fails +to import with "undefined symbol: PyInt_AsLong"; GCC 14 rejects the +implicit declarations outright. Reproduces on any arch. + +Replace each with the exact expansion SWIG <=4.4's pyhead.swg used on +Python 3 (PyBytes_Check, PyLong_Check, PyLong_AsLong), so the generated +code is unchanged for every SWIG version. + +Needed because 0001 drops the swig<4.3.0 pin, and pip then resolves +the newest swig (4.5.1), which is the release with a riscv64 wheel. + +Upstream-Status: Inappropriate [only reachable once the swig<4.3.0 pin is dropped for riscv64; upstream's pinned SWIG still defines these macros] + +Signed-off-by: Ludovic Henry +--- + src/lib/numpy.i | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/lib/numpy.i b/src/lib/numpy.i +index 60eb016..ff3db39 100644 +--- a/src/lib/numpy.i ++++ b/src/lib/numpy.i +@@ -112,8 +112,8 @@ + if (py_obj == NULL ) return "C NULL value"; + if (py_obj == Py_None ) return "Python None" ; + if (PyCallable_Check(py_obj)) return "callable" ; +- if (PyString_Check( py_obj)) return "string" ; +- if (PyInt_Check( py_obj)) return "int" ; ++ if (PyBytes_Check( py_obj)) return "string" ; ++ if (PyLong_Check( py_obj)) return "int" ; + if (PyFloat_Check( py_obj)) return "float" ; + if (PyDict_Check( py_obj)) return "dict" ; + if (PyList_Check( py_obj)) return "list" ; +@@ -1999,7 +1999,7 @@ + (PyObject* array = NULL) + { + npy_intp dims[1]; +- if (!PyInt_Check($input)) ++ if (!PyLong_Check($input)) + { + const char* typestring = pytype_string($input); + PyErr_Format(PyExc_TypeError, +@@ -2007,7 +2007,7 @@ + typestring); + SWIG_fail; + } +- $2 = (DIM_TYPE) PyInt_AsLong($input); ++ $2 = (DIM_TYPE) PyLong_AsLong($input); + dims[0] = (npy_intp) $2; + array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); + if (!array) SWIG_fail; +@@ -2027,7 +2027,7 @@ + (PyObject* array = NULL) + { + npy_intp dims[1]; +- if (!PyInt_Check($input)) ++ if (!PyLong_Check($input)) + { + const char* typestring = pytype_string($input); + PyErr_Format(PyExc_TypeError, +@@ -2035,7 +2035,7 @@ + typestring); + SWIG_fail; + } +- $1 = (DIM_TYPE) PyInt_AsLong($input); ++ $1 = (DIM_TYPE) PyLong_AsLong($input); + dims[0] = (npy_intp) $1; + array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); + if (!array) SWIG_fail;