Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .github/workflows/build-blosc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# 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
CIBW_TEST_REQUIRES: 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
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 <git@ludovic.dev>
---
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