From f521b41281c949e5443596c7f2862fcfe452e498 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Oct 2026 19:50:10 +0000 Subject: [PATCH 1/2] port: add pyrxing riscv64 wheel build tanagumo/pyrxing is a PyO3/maturin barcode/QR reader binding the real zxing-cpp C++ core (via the Rust zxing-cpp crate's "bundled" feature, compiling the same v3.1.1 sources this repo already builds for the zxing-cpp package) through a pure-Rust reader_core crate. Ships manylinux/musllinux (x86_64/aarch64), macOS and Windows wheels for cp311-cp314 but no riscv64. Mirrors the `linux` job of upstream's own build.yml, narrowed to riscv64, installing cmake before the build the same way the bundled C++ library needs it anywhere else. --- .github/workflows/build-pyrxing.yml | 127 ++++++++++++++++++++++++++++ docs/packages/pyrxing.yaml | 5 ++ 2 files changed, 132 insertions(+) create mode 100644 .github/workflows/build-pyrxing.yml create mode 100644 docs/packages/pyrxing.yaml diff --git a/.github/workflows/build-pyrxing.yml b/.github/workflows/build-pyrxing.yml new file mode 100644 index 000000000000..8686a1a673d1 --- /dev/null +++ b/.github/workflows/build-pyrxing.yml @@ -0,0 +1,127 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `linux` job of +# https://github.com/tanagumo/pyrxing/blob/v0.8.0/.github/workflows/build.yml +name: Build pyrxing wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/pyrxing.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-pyrxing.yml' + - 'docs/packages/pyrxing.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-pyrxing.yml' + - 'docs/packages/pyrxing.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: pyrxing + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build pyrxing ${{ 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) }} + # No abi3 feature on the pyo3 dependency, so every interpreter needs + # its own build, same as upstream's `-i python3.11 ... python3.14`. + python: ['cp311', 'cp312', 'cp313', 'cp314'] + + env: + PYRXING_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout pyrxing v${{ env.PYRXING_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: tanagumo/pyrxing + ref: v${{ env.PYRXING_VERSION }} + persist-credentials: false + + - name: Determine target interpreter + id: interp + run: | + v="${{ matrix.python }}" + v="${v#cp}" + echo "value=python${v:0:1}.${v:1}" >> "$GITHUB_OUTPUT" + + - name: Build wheels + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + env: + # Matches upstream's own linux job, which builds the bundled + # zxing-cpp C++ core (already proven on this riscv64 image by the + # zxing-cpp package itself) with this standard set. + CXXFLAGS: "-std=c++20" + with: + target: riscv64gc-unknown-linux-gnu + args: --release --out dist -i ${{ steps.interp.outputs.value }} + manylinux: '2_39' + before-script-linux: | + git config --global --add safe.directory "*" + yum install -y cmake + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: ${{ steps.interp.outputs.value }} + activate-environment: true + enable-cache: false + + - name: Test wheel + run: | + set -ex + uv pip install pyrxing --no-index --find-links dist --force-reinstall + uv pip install pillow + python -c " + from PIL import Image + from pyrxing import read_barcode + result = read_barcode(Image.open('assets/test_qr_code.png')) + assert result is not None and result.text, result + " + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: pyrxing-${{ env.PYRXING_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: dist/*.whl + if-no-files-found: error + + publish: + name: Publish pyrxing ${{ 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: pyrxing-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/pyrxing.yaml b/docs/packages/pyrxing.yaml new file mode 100644 index 000000000000..a8f98d5775e8 --- /dev/null +++ b/docs/packages/pyrxing.yaml @@ -0,0 +1,5 @@ +package-name: pyrxing +source-code: https://github.com/tanagumo/pyrxing +license: Apache-2.0 +versions: +- version: 0.8.0 From ac8afa0e692356c9313e46d061efd84dc938c8f9 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 25 Oct 2026 18:04:14 +0000 Subject: [PATCH 2/2] pyrxing: fix test step to use registry Pillow wheel on riscv64 uv pip install pillow resolved the newest PyPI Pillow release, which has no riscv64 wheel anywhere, so uv source-built it against missing libjpeg headers on the bare runner (gotcha 210). Point at our own registry and pass --only-binary pillow so uv falls back to the newest Pillow release our registry has a riscv64 wheel for, mirroring build-modern-colorthief.yml's Test step. --- .github/workflows/build-pyrxing.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-pyrxing.yml b/.github/workflows/build-pyrxing.yml index 8686a1a673d1..7d073a567694 100644 --- a/.github/workflows/build-pyrxing.yml +++ b/.github/workflows/build-pyrxing.yml @@ -91,11 +91,19 @@ jobs: activate-environment: true enable-cache: false + # uv has no env var for --only-binary (UV_ONLY_BINARY is silently + # ignored), so pass the flag. Our registry has no riscv64 wheel of the + # newest Pillow; this makes uv fall back to the newest release that has + # one instead of source-building it against missing libjpeg headers + # (CLAUDE.md gotcha 210). - name: Test wheel + env: + UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY: unsafe-best-match run: | set -ex uv pip install pyrxing --no-index --find-links dist --force-reinstall - uv pip install pillow + uv pip install --only-binary pillow pillow python -c " from PIL import Image from pyrxing import read_barcode