Skip to content
Draft
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
103 changes: 103 additions & 0 deletions .github/workflows/build-zuvloop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Based on upstream's own wheel-building job:
# https://github.com/Kludex/zuvloop/blob/v0.0.13/.github/workflows/publish.yml
name: Build zuvloop wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/zuvloop.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-zuvloop.yml'
- 'docs/packages/zuvloop.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-zuvloop.yml'
- 'docs/packages/zuvloop.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: zuvloop
version: ${{ inputs.version }}

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build zuvloop ${{ 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) }}
python: ["cp314", "cp314t", "cp315", "cp315t"]

env:
ZUVLOOP_VERSION: ${{ matrix.version }}

steps:
- name: Checkout zuvloop v${{ env.ZUVLOOP_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Kludex/zuvloop
ref: v${{ env.ZUVLOOP_VERSION }}
persist-credentials: false

- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
persist-credentials: false

- name: Patch zuvloop source
run: git apply python-wheels/patches/zuvloop/${{ env.ZUVLOOP_VERSION }}/*.patch

- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
only: ${{ matrix.python }}-manylinux_riscv64
env:
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: zuvloop-${{ env.ZUVLOOP_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: ./wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish zuvloop ${{ 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: zuvloop-${{ matrix.version }}-*-manylinux_riscv64
5 changes: 5 additions & 0 deletions docs/packages/zuvloop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-name: zuvloop
source-code: https://github.com/Kludex/zuvloop
license: MIT
versions:
- version: 0.0.13
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Fri, 16 Oct 2026 00:00:00 +0200
Subject: [PATCH] zig/c.zig: define RISC-V float ABI macros for @cImport

Zig 0.16's translate-c runs on Aro, whose predefined macros for RISC-V
stop at `__riscv` and `__riscv_xlen`: it never emits `__riscv_flen` or
`__riscv_float_abi_double`, which clang and GCC define for an lp64d
target. glibc's riscv `bits/setjmp.h`, pulled in by Python.h through
pthread.h, requires one of the `__riscv_float_abi_*` macros:

/usr/include/bits/setjmp.h:35:3: error: unsupported FLEN

so the @cImport of python_shim.h fails and no manylinux_riscv64 wheel
can be built (reproduced identically on cp314 and cp314t; musl's
headers do not test these macros, so a musllinux_riscv64 leg of this
matrix would be unaffected, same as the zttp case this mirrors - see
CLAUDE.md gotcha 634).

Zig master already emits these macros from Aro (ziglang/zig commit
b46a7f3a25a6, "sync aro & translate-c"); this is unnecessary once
zuvloop moves to a Zig release that contains it (zuvloop currently
pins ziglang==0.16.0).

Upstream-Status: To upstream [not yet submitted; workaround for Zig 0.16, fixed by ziglang/zig b46a7f3a25a6 on master]
---
zig/c.zig | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/zig/c.zig b/zig/c.zig
index 1c610ab..d7df92b 100644
--- a/zig/c.zig
+++ b/zig/c.zig
@@ -1,5 +1,15 @@
+const builtin = @import("builtin");
+
pub const c = @cImport({
@cDefine("PY_SSIZE_T_CLEAN", {});
+ // Zig 0.16's translate-c (Aro) predefines no RISC-V floating-point macros,
+ // so glibc's riscv bits/setjmp.h (reached via pthread.h from python_shim.h)
+ // hits `#error unsupported FLEN`. Define what clang does for an lp64d
+ // target; Zig master already emits these itself.
+ if (builtin.target.cpu.arch.isRISCV() and builtin.target.cpu.has(.riscv, .d)) {
+ @cDefine("__riscv_flen", "64");
+ @cDefine("__riscv_float_abi_double", "1");
+ }
@cInclude("python_shim.h");
@cInclude("context_shim.h");
});
--
2.43.0
Loading