Conversation
Port python-lz4 4.4.5 to riscv64, mirroring upstream's build_dist.yml
cibuildwheel job narrowed to manylinux_riscv64.
The wheel bundles lz4libs (PYLZ4_USE_SYSTEM_LZ4=False), so no system
liblz4 is needed in the container. Tests run upstream's tox suite, but
via `-e py --installpkg {wheel}` so the suite exercises the built wheel
rather than an editable install, and without the flake8/docs envs that
upstream's bare `tox -c {project}` also picks up.
|
I would take the LLM's suggestion and patch the licensing - this is something we need to keep an eye out for since we're distributing the wheels ourselves. |
The wheels statically link the bundled lz4 1.9.4 and xxHash 0.6.5 C sources under lz4libs/, but only ship python-lz4's own BSD-3-Clause LICENSE. Both vendored libraries are BSD-2-Clause and require their copyright notice to be reproduced in binary redistributions, so carry upstream PR #344 (refreshed onto v4.4.5) to add the two notices and declare them via license_files. Applying the patch dirties the checkout, which makes setuptools_scm derive 4.4.6.dev0 rather than the tag, so pin the version with SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LZ4 and drop the now-pointless full-history fetch.
v4.4.5's setup.py declares the licence only through the deprecated `License :: OSI Approved :: BSD License` classifier, so the wheel's METADATA carries no `License:`/`License-Expression:` field and update_doc.py renders the package's docs entry as `license: Unknown`. Backport the upstream commit that sets `license='BSD-3-Clause'`; the docs entry now names the licence.
|
Done — two patches under
Verified on the riscv64 artifact, not just locally: and One side effect worth flagging for the next patched port: |
Adds
.github/workflows/build-lz4.yml, porting python-lz4 4.4.5 to riscv64.Based on upstream's
build_dist.yml, narrowed tomanylinux_riscv64.Shape
Build-from-checkout with
pypa/cibuildwheel, matrix[cp312, cp313, cp314, cp314t](per-interpreter — the three extensions link the version-specific ABI; PyPI showscpXY-cpXYwheels, no abi3 tag).PYLZ4_USE_SYSTEM_LZ4=False(upstream's ownCIBW_ENVIRONMENT) builds against the bundledlz4libs/C sources, so nothing has to provide a systemliblz4in the container.pytest-run-parallel,--parallel-threads=1as on their slower arm runner). Upstream builds cp313t, which the riscv64 manylinux image does not ship; cp314t is the free-threaded target here.Deviations from upstream
Test command. Upstream's is a bare
tox -c {project}, which runsenvlist = py, flake8, docsagainst an editable install — so the wheel cibuildwheel just built is never imported, and the wheel test phase also runs flake8 and a sphinxmake doctest html. This workflow usestox -c {package} -e py --installpkg {wheel}instead: same suite, run against the actual wheel.Vendored-library licensing.
patches/lz4/4.4.5/0001-Package-licenses-of-vendored-lz4-and-xxHash-sources.patchcarries upstream PR #344 (Upstream-Status: Submitted), refreshed to apply on v4.4.5. The wheels statically link the bundled lz4 1.9.4 and xxHash 0.6.5 sources underlz4libs/, both BSD-2-Clause, whose binary-redistribution clause requires the copyright notice to be reproduced — but only python-lz4's own BSD-3-ClauseLICENSEwas shipped. The patch addslz4libs/LICENSEandlz4libs/LICENSE.xxhashand declares all three vialicense_files, so they land indist-info/licenses/.Two notes on the refresh: v4.4.5 predates the
license='BSD-3-Clause'line that upstream'ssetup.pyhunk is anchored on, and the xxHash copyright line here follows the vendoredlz4libs/xxhash.cheader (2012-2016) rather than the wider range used in that PR.0002-Switch-to-SPDX-license-expression.patchbackports #324 (Upstream-Status: Backport), merged just after v4.4.5. Without it the wheel's METADATA carries noLicense:field at all — only the deprecated classifier — soupdate_doc.pyrenders the package's docs entry aslicense: Unknown.Applying the patch dirties the checkout, so
setuptools_scmderived4.4.6.dev0fromgit describeinstead of the tag; the version is now pinned withSETUPTOOLS_SCM_PRETEND_VERSION_FOR_LZ4, and the full-history fetch it needed is gone.Validation
Ran the full workflow config through cibuildwheel locally on linux/aarch64 (native, Docker) for both
cp312-manylinux_aarch64andcp314t-manylinux_aarch64:4.4.5from the tag inside the container (setuptools_scm),lz4/_version…so,lz4/block/_block…so,lz4/frame/_frame…soanddist-info/licenses/LICENSE,19804 passedin both cases, coverage reporting 0% on the source tree — i.e. the installed wheel was imported, not the checkout.For the licensing patch, rebuilt natively (shallow
v4.4.5clone +git apply+ the workflow's env) and confirmed the wheel islz4-4.4.5-…carrying all three extension modules andThe riscv64
cp314artifact from the first patched run confirms the same on the real target:lz4-4.4.5-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl, three extension modules, all threeLicense-File:entries inMETADATA, andlibc.so.6as the only linked library — so nothing else needs a licence carried with it.actionlintclean apart from the usuallabel "ubuntu-24.04-riscv" is unknown.