From 734064724b6bd2e7277c82b33c66b1fa6c6cfb10 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 13 Oct 2026 08:09:41 +0000 Subject: [PATCH 1/3] xtgeo: Add version 4.25.1 --- .github/workflows/build-xtgeo.yml | 123 ++++++ docs/packages/xtgeo.yaml | 6 + .../4.25.1/0001-unpin-swig-for-riscv64.patch | 34 ++ ...-for-swig-4.3-appendoutput-signature.patch | 377 ++++++++++++++++++ 4 files changed, 540 insertions(+) create mode 100644 .github/workflows/build-xtgeo.yml create mode 100644 docs/packages/xtgeo.yaml create mode 100644 patches/xtgeo/4.25.1/0001-unpin-swig-for-riscv64.patch create mode 100644 patches/xtgeo/4.25.1/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch diff --git a/.github/workflows/build-xtgeo.yml b/.github/workflows/build-xtgeo.yml new file mode 100644 index 000000000000..a095b5af6ed8 --- /dev/null +++ b/.github/workflows/build-xtgeo.yml @@ -0,0 +1,123 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/equinor/xtgeo/blob/v4.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: v${{ env.XTGEO_VERSION }} + fetch-depth: 0 # setuptools_scm derives the version from the tag history + 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 }} + 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). + CIBW_ENVIRONMENT: >- + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + PIP_ONLY_BINARY=numpy,pandas,scipy,pyarrow,h5py,hdf5plugin,matplotlib,segyio,shapely + 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..ac3384e819fb --- /dev/null +++ b/patches/xtgeo/4.25.1/0002-fix-numpy-i-for-swig-4.3-appendoutput-signature.patch @@ -0,0 +1,377 @@ +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. + +Pass is_void=0 at every call site. That is the behaviour-preserving +value: pyrun.swg's is_void only changes behaviour when $result is +Py_None, by skipping the list-wrapping branch so a void primary return +is replaced outright instead of turned into a list; the pre-4.3 +two-arg function always took the list-wrapping branch, which is what +is_void=0 reproduces. + +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..464927d 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_Python_AppendOutput($result,(PyObject*)array$argnum,0); + } + + /* 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_Python_AppendOutput($result,(PyObject*)array$argnum,0); + } + + /* 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_Python_AppendOutput($result,(PyObject*)array$argnum,0); + } + + /* 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_Python_AppendOutput($result,(PyObject*)array$argnum,0); + } + + /* 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_Python_AppendOutput($result,(PyObject*)array$argnum,0); + } + + /* 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_Python_AppendOutput($result,(PyObject*)array$argnum,0); + } + + /*****************************/ +@@ -2123,7 +2123,7 @@ + PyArrayObject* array = (PyArrayObject*) obj; + + if (!array) SWIG_fail; +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /*************************************/ +@@ -2466,7 +2466,7 @@ + PyArray_SetBaseObject(array,cap); + %#endif + +- $result = SWIG_Python_AppendOutput($result,obj); ++ $result = SWIG_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /* 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_Python_AppendOutput($result,obj,0); + } + + /**************************************/ From feeaca497d94faed98a58ebcb29165adfd5c58ba Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 23 Oct 2026 17:02:22 +0000 Subject: [PATCH 2/3] xtgeo: Fix checkout ref, before-all, version and SWIG 4.5 build Upstream tags releases without a "v" prefix, so check out ${XTGEO_VERSION} rather than v${XTGEO_VERSION}; every build job failed at checkout with "A branch or tag with the name 'v4.25.1' could not be found". Override the inherited [tool.cibuildwheel.linux] before-all: fmt-devel is EPEL-only and the riscv64 manylinux image has no EPEL, so "yum install -y eigen3-devel fmt-devel" exits non-zero there. Install eigen3-devel (CRB) only; CMake already falls back to FetchContent for fmt. Pin SETUPTOOLS_SCM_PRETEND_VERSION_FOR_XTGEO: applying the patches leaves the tree dirty and setuptools_scm otherwise versions the wheel 4.25.2.dev0. The full-history fetch is no longer needed. Patch 0002 now calls SWIG_AppendOutput() so void functions keep SWIG's $isvoid behaviour; the hardcoded is_void=0 made them return [None, ...]. New patch 0003 replaces the PyString_Check, PyInt_Check and PyInt_AsLong macros that SWIG 4.5 removed, which left _cxtgeo with an undefined PyInt_AsLong symbol. --- .github/workflows/build-xtgeo.yml | 8 +- ...-for-swig-4.3-appendoutput-signature.patch | 92 ++++++++++--------- ...-for-swig-4.5-removed-python2-macros.patch | 78 ++++++++++++++++ 3 files changed, 130 insertions(+), 48 deletions(-) create mode 100644 patches/xtgeo/4.25.1/0003-fix-numpy-i-for-swig-4.5-removed-python2-macros.patch diff --git a/.github/workflows/build-xtgeo.yml b/.github/workflows/build-xtgeo.yml index a095b5af6ed8..e4a674901b8d 100644 --- a/.github/workflows/build-xtgeo.yml +++ b/.github/workflows/build-xtgeo.yml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2026 The RISE Project # SPDX-License-Identifier: MIT --- -# This workflow is based on: https://github.com/equinor/xtgeo/blob/v4.25.1/.github/workflows/publish.yml +# This workflow is based on: https://github.com/equinor/xtgeo/blob/4.25.1/.github/workflows/publish.yml name: Build xtgeo wheels (riscv64) on: @@ -64,8 +64,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: equinor/xtgeo - ref: v${{ env.XTGEO_VERSION }} - fetch-depth: 0 # setuptools_scm derives the version from the tag history + ref: ${{ env.XTGEO_VERSION }} persist-credentials: false - name: Checkout python-wheels @@ -84,6 +83,8 @@ jobs: 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 @@ -91,6 +92,7 @@ jobs: CIBW_ENVIRONMENT: >- PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ PIP_ONLY_BINARY=numpy,pandas,scipy,pyarrow,h5py,hdf5plugin,matplotlib,segyio,shapely + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_XTGEO=${{ env.XTGEO_VERSION }} CIBW_TEST_EXTRAS: dev CIBW_BEFORE_TEST: >- pushd {package} && 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 index ac3384e819fb..ee2c36a27240 100644 --- 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 @@ -10,12 +10,14 @@ 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. -Pass is_void=0 at every call site. That is the behaviour-preserving -value: pyrun.swg's is_void only changes behaviour when $result is -Py_None, by skipping the list-wrapping branch so a void primary return -is replaced outright instead of turned into a list; the pre-4.3 -two-arg function always took the list-wrapping branch, which is what -is_void=0 reproduces. +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 @@ -30,7 +32,7 @@ Signed-off-by: Ludovic Henry 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/lib/numpy.i b/src/lib/numpy.i -index b8fdaeb..464927d 100644 +index b8fdaeb..60eb016 100644 --- a/src/lib/numpy.i +++ b/src/lib/numpy.i @@ -1988,7 +1988,7 @@ @@ -38,7 +40,7 @@ index b8fdaeb..464927d 100644 (DATA_TYPE ARGOUT_ARRAY1[ANY]) { - $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); -+ $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum,0); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); } /* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) @@ -47,7 +49,7 @@ index b8fdaeb..464927d 100644 (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) { - $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); -+ $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum,0); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); } /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) @@ -56,7 +58,7 @@ index b8fdaeb..464927d 100644 (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) { - $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); -+ $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum,0); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); } /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) @@ -65,7 +67,7 @@ index b8fdaeb..464927d 100644 (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) { - $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); -+ $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum,0); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); } /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) @@ -74,7 +76,7 @@ index b8fdaeb..464927d 100644 (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) { - $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); -+ $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum,0); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); } /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY]) @@ -83,7 +85,7 @@ index b8fdaeb..464927d 100644 (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY]) { - $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum); -+ $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum,0); ++ $result = SWIG_AppendOutput($result,(PyObject*)array$argnum); } /*****************************/ @@ -92,7 +94,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) @@ -101,7 +103,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) @@ -110,7 +112,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) @@ -119,7 +121,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) @@ -128,7 +130,7 @@ index b8fdaeb..464927d 100644 if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) @@ -137,7 +139,7 @@ index b8fdaeb..464927d 100644 if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -146,7 +148,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, @@ -155,7 +157,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -164,7 +166,7 @@ index b8fdaeb..464927d 100644 if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, @@ -173,7 +175,7 @@ index b8fdaeb..464927d 100644 if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -182,7 +184,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, @@ -191,7 +193,7 @@ index b8fdaeb..464927d 100644 if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -200,7 +202,7 @@ index b8fdaeb..464927d 100644 if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, @@ -209,7 +211,7 @@ index b8fdaeb..464927d 100644 if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /*************************************/ @@ -218,7 +220,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1) @@ -227,7 +229,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) @@ -236,7 +238,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2) @@ -245,7 +247,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) @@ -254,7 +256,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2) @@ -263,7 +265,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -272,7 +274,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, @@ -281,7 +283,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -290,7 +292,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, @@ -299,7 +301,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -308,7 +310,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, @@ -317,7 +319,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -326,7 +328,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, @@ -335,7 +337,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -344,7 +346,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, @@ -353,7 +355,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, @@ -362,7 +364,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $result = SWIG_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, @@ -371,7 +373,7 @@ index b8fdaeb..464927d 100644 %#endif - $result = SWIG_Python_AppendOutput($result,obj); -+ $result = SWIG_Python_AppendOutput($result,obj,0); ++ $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; From ecfd438bc621e11d0fc9208c281b102a92076085 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 25 Oct 2026 17:53:41 +0000 Subject: [PATCH 3/3] xtgeo: fix cp313 CI by adding pillow to PIP_ONLY_BINARY matplotlib (a direct xtgeo runtime dependency) pulls in pillow, whose newest PyPI release has no riscv64 wheel. pip fell back to building pillow's sdist, which fails with "RequiredDependencyException: jpeg" since the manylinux_2_39_riscv64 image carries no libjpeg headers (gotcha 291). Our own registry already hosts riscv64 pillow wheels for cp312/cp313/cp314 (verified via ci_scripts/check_riscv64_deps.py), so listing pillow in PIP_ONLY_BINARY makes pip prefer those instead. --- .github/workflows/build-xtgeo.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-xtgeo.yml b/.github/workflows/build-xtgeo.yml index e4a674901b8d..fd1df4aaadb2 100644 --- a/.github/workflows/build-xtgeo.yml +++ b/.github/workflows/build-xtgeo.yml @@ -88,10 +88,13 @@ jobs: 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). + # 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 + 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: >-