diff --git a/.github/workflows/build-python-rtmidi.yml b/.github/workflows/build-python-rtmidi.yml new file mode 100644 index 000000000..544779d37 --- /dev/null +++ b/.github/workflows/build-python-rtmidi.yml @@ -0,0 +1,92 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/SpotlightKid/python-rtmidi/blob/1.5.8/.github/workflows/pr_to_master.yml +name: Build python-rtmidi wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'python-rtmidi version to build (git tag, e.g. 1.5.8)' + required: true + default: '1.5.8' + pull_request: + paths: + - '.github/workflows/build-python-rtmidi.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '1.5.8' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + PYTHON_RTMIDI_VERSION: ${{ inputs.version || '1.5.8' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build python-rtmidi ${{ inputs.version || '1.5.8' }} cp312-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 120 + + steps: + - name: Checkout python-rtmidi ${{ env.PYTHON_RTMIDI_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: SpotlightKid/python-rtmidi + ref: ${{ env.PYTHON_RTMIDI_VERSION }} + submodules: true + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Patch python-rtmidi source + run: git apply python-wheels/patches/python-rtmidi/${{ env.PYTHON_RTMIDI_VERSION }}/*.patch + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: '3.12' + activate-environment: true + enable-cache: false + + - name: Install cibuildwheel + run: uv pip install cibuildwheel + + # Build/test settings (before-all installing alsa-lib-devel and building + # jack2 from source, the auditwheel --exclude libasound.so.2 repair, and + # the pytest -m ci test selection) all come from upstream's own + # [tool.cibuildwheel] in pyproject.toml; only the riscv64 image and + # version selection are set here. + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_BUILD: cp312-manylinux_riscv64 + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: python-rtmidi-${{ env.PYTHON_RTMIDI_VERSION }}-cp312-manylinux_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish python-rtmidi ${{ inputs.version || '1.5.8' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: python-rtmidi-${{ inputs.version || '1.5.8' }}-*-manylinux_riscv64 diff --git a/patches/python-rtmidi/1.5.8/0001-pyproject.toml-declare-license-files-so-the-wheel-sh.patch b/patches/python-rtmidi/1.5.8/0001-pyproject.toml-declare-license-files-so-the-wheel-sh.patch new file mode 100644 index 000000000..562038e09 --- /dev/null +++ b/patches/python-rtmidi/1.5.8/0001-pyproject.toml-declare-license-files-so-the-wheel-sh.patch @@ -0,0 +1,69 @@ +From 1cfd8bc468fac5c9b29a3f0e5bfcc3799f7c09e7 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Mon, 7 Sep 2026 15:36:19 +0200 +Subject: [PATCH] pyproject.toml: declare license-files so the wheel ships + jack2's licence + +meson-python only auto-includes the file named in the legacy +[project.license].file table (a single file, no glob); it does not +implement the PEP 639 default LICEN[CS]E* glob that setuptools and +scikit-build-core apply when license-files is absent. [tool.cibuildwheel +.linux] before-all builds JACK2 1.9.22 from source and links libjack (LGPL +v2.1+) into the extension - auditwheel then vendors libjack.so.0 into the +wheel (only libasound.so.2 is excluded via --exclude) - so its licence has +to travel with the wheel too. + +Switch project.license to the SPDX string form (dropping the now-redundant +'License :: OSI Approved :: MIT License' classifier, which pyproject- +metadata rejects alongside an SPDX expression) and add license-files +listing both LICENSE.md and a new LICENSE.jack2. The before-all list gains +one more step, copying jack2's own COPYING to the project root as +LICENSE.jack2 right after 'waf install', so it exists before meson-python +reads project metadata. + +Upstream-Status: To upstream [not submitted from this automated port run; needs a pull request against SpotlightKid/python-rtmidi] +--- + pyproject.toml | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 7aa8213..65cdfca 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -16,13 +16,14 @@ authors = [ + ] + readme = "README.md" + requires-python = ">=3.8" ++license = "MIT" ++license-files = ["LICENSE.md", "LICENSE.jack2"] + classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: MacOS X", + "Environment :: Win32 (MS Windows)", + "Environment :: Console", + "Intended Audience :: Developers", +- "License :: OSI Approved :: MIT License", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: MacOS :: MacOS X", +@@ -50,9 +51,6 @@ setup = [ + "-Dbuildtype=plain" + ] + +-[project.license] +-file = "LICENSE.md" +- + [project.urls] + "Bug Tracker" = "https://github.com/SpotlightKid/python-rtmidi/issues" + "Documentation" = "https://spotlightkid.github.io/python-rtmidi/" +@@ -109,6 +107,7 @@ before-all = [ + "python3 waf configure --prefix=/usr --autostart=none --classic --pkgconfigdir=/usr/lib64/pkgconfig", + "python3 waf build", + "python3 waf install", ++ "cp COPYING ../LICENSE.jack2", + ] + repair-wheel-command = "auditwheel repair --exclude libasound.so.2 --lib-sdir . -w {dest_dir} {wheel}" + +-- +2.50.1 (Apple Git-155) +