From 2ef8aa14fd9c510b4c1472607dee61a69137cc20 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 8 Sep 2026 06:48:14 +0200 Subject: [PATCH 1/2] blosc: add build-blosc.yml for riscv64 wheels C-Blosc's own CMakeLists.txt already gates SSE2/AVX2 on a recognized x86 CMAKE_SYSTEM_PROCESSOR and falls back to its portable shuffle-generic.c/bitshuffle-generic.c path with just a warning otherwise, so riscv64 needs no SIMD-fallback patch. Verified locally by building and running the full test suite on macOS arm64 (an equally-unrecognized architecture for this old c-blosc), which exercises the same code path riscv64 will. One patch adds an explicit license_files list (setup.py sets none today, so setuptools' default LICEN[CS]E* glob only picks up this project's own LICENSE.txt) covering c-blosc's own licence plus the codecs it statically compiles in by default (LZ4, zlib), including a restored LICENSE for the vendored zstd 1.5.6 tree, which never carried one over from upstream. --- .github/workflows/build-blosc.yml | 120 ++++++++++++++++++ ...s-of-what-the-wheel-actually-bundles.patch | 92 ++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 .github/workflows/build-blosc.yml create mode 100644 patches/blosc/1.11.4/0001-Ship-the-licences-of-what-the-wheel-actually-bundles.patch diff --git a/.github/workflows/build-blosc.yml b/.github/workflows/build-blosc.yml new file mode 100644 index 000000000..b7243f516 --- /dev/null +++ b/.github/workflows/build-blosc.yml @@ -0,0 +1,120 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build_wheels` job of +# https://github.com/blosc/python-blosc/blob/v1.11.4/.github/workflows/cibuildwheels.yml +name: Build blosc wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'blosc version to build (git tag without leading v, e.g. 1.11.4)' + required: true + default: '1.11.4' + pull_request: + paths: + - '.github/workflows/build-blosc.yml' + - 'patches/blosc/**' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '1.11.4' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # `inputs.version` is empty on pull_request events; default to 1.11.4 there. + BLOSC_VERSION: ${{ inputs.version || '1.11.4' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build blosc ${{ inputs.version || '1.11.4' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + python: [cp312, cp313, cp314, cp314t] + + steps: + - name: Checkout python-blosc v${{ env.BLOSC_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: blosc/python-blosc + ref: v${{ env.BLOSC_VERSION }} + submodules: recursive + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Patch python-blosc source + run: git apply python-wheels/patches/blosc/${{ env.BLOSC_VERSION }}/*.patch + + - 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 }} + # C-Blosc's own CMakeLists.txt gates SSE2/AVX2 on a recognized x86 + # CMAKE_SYSTEM_PROCESSOR and warns-not-fails otherwise, so riscv64 + # falls straight back to its portable shuffle-generic.c path -- no + # patch needed for the SIMD codec gating itself. + CIBW_ENVIRONMENT: >- + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + PIP_ONLY_BINARY=numpy + # numpy has a riscv64 wheel on this registry only up to cp312; + # newer interpreters skip the numpy-guarded tests instead (test.py + # checks `has_numpy` and skips), same as upstream's own CI, which + # never installs numpy for the free-threaded build either. + CIBW_TEST_REQUIRES: ${{ matrix.python == 'cp312' && 'numpy' || '' }} + CIBW_TEST_COMMAND: python -m blosc.test + + - name: Check wheel contents + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + + names = zipfile.ZipFile(sys.argv[1]).namelist() + exts = {n for n in names if n.startswith("blosc/") and n.endswith(".so")} + assert len(exts) == 1 and next(iter(exts)).startswith("blosc/blosc_extension"), exts + + licences = {n.split(".dist-info/licenses/", 1)[1] for n in names + if ".dist-info/licenses/" in n and not n.endswith("/")} + assert licences == { + "LICENSE.txt", + "blosc/c-blosc/LICENSE.txt", + "blosc/c-blosc/LICENSES/BITSHUFFLE.txt", + "blosc/c-blosc/LICENSES/FASTLZ.txt", + "blosc/c-blosc/LICENSES/LZ4.txt", + "blosc/c-blosc/LICENSES/ZLIB.txt", + "blosc/c-blosc/LICENSES/ZSTD.txt", + }, licences + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: blosc-${{ env.BLOSC_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish blosc ${{ inputs.version || '1.11.4' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: blosc-${{ inputs.version || '1.11.4' }}-*-manylinux_riscv64 diff --git a/patches/blosc/1.11.4/0001-Ship-the-licences-of-what-the-wheel-actually-bundles.patch b/patches/blosc/1.11.4/0001-Ship-the-licences-of-what-the-wheel-actually-bundles.patch new file mode 100644 index 000000000..0d88dd4f3 --- /dev/null +++ b/patches/blosc/1.11.4/0001-Ship-the-licences-of-what-the-wheel-actually-bundles.patch @@ -0,0 +1,92 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Tue, 8 Sep 2026 00:00:00 +0000 +Subject: [PATCH] Ship the licences of what the wheel actually bundles + +setup.py sets no `license_files`, so setuptools falls back to its +default `LICEN[CS]E*` glob at the project root, which only ever picks +up this project's own LICENSE.txt (confirmed by building the wheel +locally: `blosc-1.11.4.dist-info/licenses/` held just that one file). + +That leaves out the licences of the c-blosc submodule this build +statically compiles into the extension: c-blosc's own LICENSE.txt +(blosc.c, blosclz.c, shuffle.c, ...), and the codecs its CMakeLists.txt +includes by default (LZ4, zlib, and the FastLZ- and Bitshuffle-derived +code in blosclz.c/bitshuffle-generic.c, all credited in +c-blosc/LICENSES/). Snappy stays out (deactivated by default, matching +this build) and so does the Windows-only STDINT.txt shim. + +c-blosc/internal-complibs/zstd-1.5.6 is missing a licence file +entirely -- confirmed byte-identical to upstream zstd v1.5.6's lib/ +tree, whose LICENSE (BSD, at the zstd repo root) never got carried +over when it was vendored. Restoring that exact file lets +license_files pick it up the same way as the other codecs' notices, +rather than leaving zstd unlicensed in the wheel. + +Upstream-Status: To upstream [not submitted: no cross-repo issue/PR contributions from this port] + +Signed-off-by: Ludovic Henry +--- + blosc/c-blosc/LICENSES/ZSTD.txt | 30 ++++++++++++++++++++++++++++++ + setup.py | 9 +++++++++ + 2 files changed, 39 insertions(+) + create mode 100644 blosc/c-blosc/LICENSES/ZSTD.txt + +diff --git a/blosc/c-blosc/LICENSES/ZSTD.txt b/blosc/c-blosc/LICENSES/ZSTD.txt +new file mode 100644 +index 0000000..7580028 +--- /dev/null ++++ b/blosc/c-blosc/LICENSES/ZSTD.txt +@@ -0,0 +1,30 @@ ++BSD License ++ ++For Zstandard software ++ ++Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without modification, ++are permitted provided that the following conditions are met: ++ ++ * Redistributions of source code must retain the above copyright notice, this ++ list of conditions and the following disclaimer. ++ ++ * Redistributions in binary form must reproduce the above copyright notice, ++ this list of conditions and the following disclaimer in the documentation ++ and/or other materials provided with the distribution. ++ ++ * Neither the name Facebook, nor Meta, nor the names of its contributors may ++ be used to endorse or promote products derived from this software without ++ specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ++ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ++ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +diff --git a/setup.py b/setup.py +index 8f1748d..2841ef3 100644 +--- a/setup.py ++++ b/setup.py +@@ -98,6 +98,15 @@ if __name__ == '__main__': + setup_requires=['scikit-build'], + tests_require=['numpy', 'psutil'], + packages = ['blosc'], ++ license_files = [ ++ 'LICENSE.txt', ++ 'blosc/c-blosc/LICENSE.txt', ++ 'blosc/c-blosc/LICENSES/BITSHUFFLE.txt', ++ 'blosc/c-blosc/LICENSES/FASTLZ.txt', ++ 'blosc/c-blosc/LICENSES/LZ4.txt', ++ 'blosc/c-blosc/LICENSES/ZLIB.txt', ++ 'blosc/c-blosc/LICENSES/ZSTD.txt', ++ ], + ) + elif __name__ == '__mp_main__': + # This occurs from `cpuinfo 4.0.0` using multiprocessing to interrogate the +-- +2.43.0 From 53b6f994020ed287e583e4f11743648b50b00803 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 8 Sep 2026 06:54:17 +0200 Subject: [PATCH 2/2] blosc: test with numpy on every leg, not just cp312 The registry does have riscv64 numpy wheels for cp313/cp314/cp314t too (numpy >= 2.3.3, manylinux_2_38/2_39_riscv64) -- an earlier check missed them by grepping only for the legacy `linux_riscv64.whl` filename suffix, which the newer manylinux_2_38/2_39-tagged wheels don't use. Drop the cp312-only restriction. --- .github/workflows/build-blosc.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-blosc.yml b/.github/workflows/build-blosc.yml index b7243f516..fe343fecb 100644 --- a/.github/workflows/build-blosc.yml +++ b/.github/workflows/build-blosc.yml @@ -74,11 +74,7 @@ jobs: CIBW_ENVIRONMENT: >- PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ PIP_ONLY_BINARY=numpy - # numpy has a riscv64 wheel on this registry only up to cp312; - # newer interpreters skip the numpy-guarded tests instead (test.py - # checks `has_numpy` and skips), same as upstream's own CI, which - # never installs numpy for the free-threaded build either. - CIBW_TEST_REQUIRES: ${{ matrix.python == 'cp312' && 'numpy' || '' }} + CIBW_TEST_REQUIRES: numpy CIBW_TEST_COMMAND: python -m blosc.test - name: Check wheel contents