Skip to content

Commit 161bcfd

Browse files
authored
zxing-cpp: add build-zxing-cpp.yml for riscv64 wheels (#1653)
* **Package**: `zxing-cpp` * **Version**: `3.1.1` * **Source**: https://github.com/zxing-cpp/zxing-cpp * **Docs**: https://github.com/zxing-cpp/zxing-cpp Compiles the ZXing-C++ barcode/QR-code reading and writing library into a nanobind Python extension. Upstream publishes no riscv64 wheel. Mirrors [upstream's `publish-python.yml`](https://github.com/zxing-cpp/zxing-cpp/blob/v3.1.1/.github/workflows/publish-python.yml), building `wrappers/python` straight from the checkout. **Differs from upstream** - Drops cp310/cp311 and musllinux - matches this repo's cp312 floor and upstream's own `skip` list. **Matrix**: cp312 (abi3, also covers cp313/cp314) and cp314t only - the nanobind module is built `STABLE_ABI FREE_THREADED`, so one non-free-threaded build satisfies every interpreter. **Testing** - same as upstream **License**: OK Built on cp312; pending CI results.
1 parent 85f53fa commit 161bcfd

2 files changed

Lines changed: 127 additions & 0 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on upstream's own wheel build setup:
5+
# https://github.com/zxing-cpp/zxing-cpp/blob/v3.1.1/.github/workflows/publish-python.yml
6+
# https://github.com/zxing-cpp/zxing-cpp/blob/v3.1.1/wrappers/python/pyproject.toml
7+
name: Build zxing-cpp wheels (riscv64)
8+
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'zxing-cpp version/tag to build (git tag without leading v, e.g. 3.1.1)'
14+
required: true
15+
default: '3.1.1'
16+
pull_request:
17+
paths:
18+
- '.github/workflows/build-zxing-cpp.yml'
19+
- 'patches/zxing-cpp/**'
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ inputs.version || '3.1.1' }}-${{ github.head_ref || github.run_id }}
23+
cancel-in-progress: true
24+
25+
permissions:
26+
contents: read # to fetch code (actions/checkout)
27+
28+
env:
29+
ZXING_CPP_VERSION: ${{ inputs.version || '3.1.1' }}
30+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
31+
32+
jobs:
33+
setup:
34+
uses: $/.github/workflows/_setup.yml
35+
36+
build_wheels:
37+
needs: [setup]
38+
name: Build zxing-cpp ${{ inputs.version || '3.1.1' }} ${{ matrix.build }}
39+
runs-on: ubuntu-24.04-riscv
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
# wrappers/python/pyproject.toml builds a STABLE_ABI nanobind module tagged
44+
# cp312-abi3, so one cp312 build covers cp312/cp313/cp314; only the
45+
# FREE_THREADED cp314t build needs its own wheel (upstream's own build list is
46+
# cp310-cp312 + cp313t/cp314t, collapsed the same way per gotcha 11).
47+
build:
48+
- "cp312-manylinux_riscv64"
49+
- "cp314t-manylinux_riscv64"
50+
51+
steps:
52+
- name: Checkout zxing-cpp v${{ env.ZXING_CPP_VERSION }}
53+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
54+
with:
55+
repository: zxing-cpp/zxing-cpp
56+
ref: v${{ env.ZXING_CPP_VERSION }}
57+
submodules: true
58+
persist-credentials: false
59+
60+
- name: Checkout python-wheels
61+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
62+
with:
63+
path: python-wheels
64+
persist-credentials: false
65+
66+
- name: Apply patches
67+
run: git apply python-wheels/patches/zxing-cpp/${{ env.ZXING_CPP_VERSION }}/*.patch
68+
69+
- uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
70+
with:
71+
package-dir: wrappers/python
72+
only: ${{ matrix.build }}
73+
env:
74+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
75+
76+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
77+
with:
78+
name: zxing-cpp-${{ env.ZXING_CPP_VERSION }}-${{ matrix.build }}
79+
path: ./wheelhouse/*.whl
80+
if-no-files-found: error
81+
82+
publish:
83+
name: Publish zxing-cpp ${{ inputs.version || '3.1.1' }}
84+
needs: [setup, build_wheels]
85+
permissions:
86+
contents: write
87+
pull-requests: write
88+
uses: $/.github/workflows/_publish-wheel.yml
89+
with:
90+
artifact-pattern: zxing-cpp-${{ inputs.version || '3.1.1' }}-*-manylinux_riscv64
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Wed, 10 Sep 2026 00:00:00 +0000
4+
Subject: [PATCH] python: drop the cpython-freethreading cibuildwheel enable
5+
group
6+
7+
Upstream-Status: Inappropriate [pinned to an older cibuildwheel release for this repo's other ports]
8+
9+
wrappers/python/pyproject.toml's [tool.cibuildwheel] table sets
10+
`enable = ["cpython-freethreading"]`, a group name introduced in a
11+
cibuildwheel release newer than the one this repo pins
12+
(pypa/cibuildwheel@1828c10, v4.2.0). That version's config parser
13+
rejects it outright: "Failed to parse enable group. Unknown enable
14+
group: cpython-freethreading. Valid group names are:
15+
cpython-prerelease, graalpy, pypy, pypy-eol, pyodide-eol,
16+
pyodide-prerelease" -- this aborts before build selection even runs,
17+
so setting `CIBW_ENABLE=""` in the workflow env does not help, since
18+
an empty override doesn't override, it turns off.
19+
20+
The cp314t leg is already selected explicitly via this repo's own
21+
`only:` matrix entry in build-zxing-cpp.yml, so the enable group is
22+
redundant for our build regardless of cibuildwheel version.
23+
24+
diff --git a/wrappers/python/pyproject.toml b/wrappers/python/pyproject.toml
25+
index 0000000..0000000 100644
26+
--- a/wrappers/python/pyproject.toml
27+
+++ b/wrappers/python/pyproject.toml
28+
@@ -54,7 +54,6 @@
29+
# note: stable ABI and free-threaded builds are mutually exclusive,
30+
# see https://nanobind.readthedocs.io/en/latest/free_threaded.html
31+
build = ["cp310-*", "cp311-*", "cp312-*", "cp313t-*", "cp314t-*"]
32+
-enable = ["cpython-freethreading"]
33+
skip = ["*musllinux*", "*-win32"]
34+
# TODO: setup a "BEFORE" cmake build and link the python module to the prebuild libZXing.a
35+
# see https://github.com/YannickJadoul/Parselmouth/blob/523c117aa780184345121f6ff8315670bc7d4d94/.github/workflows/wheels.yml#L120
36+
--
37+
2.43.0

0 commit comments

Comments
 (0)