diff --git a/.github/workflows/build-xtgeo.yml b/.github/workflows/build-xtgeo.yml new file mode 100644 index 000000000000..fd1df4aaadb2 --- /dev/null +++ b/.github/workflows/build-xtgeo.yml @@ -0,0 +1,128 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/equinor/xtgeo/blob/4.25.1/.github/workflows/publish.yml +name: Build xtgeo wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/xtgeo.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-xtgeo.yml' + - 'docs/packages/xtgeo.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-xtgeo.yml' + - 'docs/packages/xtgeo.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: xtgeo + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build xtgeo ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # Matches upstream's own matrix (cp311-cp314) minus cp311: numpy>=2.5 + # sets 3.12 as its floor and our registry only hosts that line. + python: + - "cp312" + - "cp313" + - "cp314" + + env: + XTGEO_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout xtgeo ${{ env.XTGEO_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: equinor/xtgeo + ref: ${{ env.XTGEO_VERSION }} + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Apply patches + run: git apply python-wheels/patches/xtgeo/${{ env.XTGEO_VERSION }}/*.patch + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # fmt-devel is EPEL-only and riscv64 has no EPEL; CMake fetches fmt instead. + CIBW_BEFORE_ALL_LINUX: yum install -y eigen3-devel + CIBW_BEFORE_BUILD: python -m pip install -U pip + # numpy has no riscv64 wheel on public PyPI; PIP_ONLY_BINARY keeps pip + # from source-building it (both for the build and for CIBW_TEST_COMMAND's + # test-extras install). pillow is listed too (gotcha 291): it's a + # transitive matplotlib dep, PyPI's newest pillow sdist has no riscv64 + # wheel and fails to build from source (missing libjpeg headers in the + # manylinux image) - our own registry carries riscv64 pillow wheels. + CIBW_ENVIRONMENT: >- + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + 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 + CIBW_BEFORE_TEST: >- + pushd {package} && + git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata || true + CIBW_TEST_COMMAND: >- + pushd {package} && + pytest -n 4 tests --disable-warnings -m "not hypothesis" --ignore tests/test_well --ignore-glob="*forks.py" + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: xtgeo-${{ env.XTGEO_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish xtgeo ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: xtgeo-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/xtgeo.yaml b/docs/packages/xtgeo.yaml new file mode 100644 index 000000000000..16f61c7204aa --- /dev/null +++ b/docs/packages/xtgeo.yaml @@ -0,0 +1,6 @@ +package-name: xtgeo +source-code: https://github.com/equinor/xtgeo +license: LGPL-3.0 +versions: +- version: 4.25.1 + patched: true diff --git a/patches/xtgeo/4.25.1/0001-unpin-swig-for-riscv64.patch b/patches/xtgeo/4.25.1/0001-unpin-swig-for-riscv64.patch new file mode 100644 index 000000000000..0709ec188a17 --- /dev/null +++ b/patches/xtgeo/4.25.1/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.25.1/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch b/patches/xtgeo/4.25.1/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch new file mode 100644 index 000000000000..ee2c36a27240 --- /dev/null +++ b/patches/xtgeo/4.25.1/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.25.1/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch b/patches/xtgeo/4.25.1/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.25.1/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;