Conversation
PyMuPDF builds MuPDF from source (downloaded at build time), generates MuPDF's C++ bindings with libclang and wraps them with SWIG, so the riscv64 port needs three overrides: * PYMUPDF_SETUP_LIBCLANG=clang - the default `libclang` PyPI wheel has no riscv64 build; use the pure-Python `clang` bindings against the image's own libclang.so (dnf clang-devel). * PYMUPDF_SETUP_SWIG=swig - reuse the manylinux image's swig 4.4.1 rather than building the `swig` sdist in-container. * XCFLAGS/XCXXFLAGS=-D__LITTLE_ENDIAN__ - mupdf's tesseract endianness.h detects endianness from arch-specific predefines and has no riscv64 case, so it hard-errors with "I don't know what architecture this is!". Matrix mirrors upstream's two wheel shapes: one cp312-abi3 build and one free-threaded cp314t build (pipcl refuses Py_LIMITED_API together with Py_GIL_DISABLED). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a riscv64 wheel build for pymupdf 1.28.2.
Shape
build-from-checkout+pypa/cibuildwheel. PyMuPDF's PEP-517 backend (pipcl,in-tree
setup.py) downloads the matching MuPDF source tarball at build time,builds all of MuPDF (incl. tesseract/leptonica), generates MuPDF's C++ bindings
by parsing its headers with libclang, wraps them with SWIG, and finally compiles
PyMuPDF's own
_extraextension — so the wheel job is one long native build.riscv64-specific overrides
PYMUPDF_SETUP_LIBCLANG=clang—setup.py'sget_requires_for_build_wheel()asks for thelibclangPyPI wheel, whichships no riscv64 build (and its sdist just repackages prebuilt binaries).
Instead we install the pure-Python
clangbindings and letclang.cindexdlopen the image's own
libclang.so— hencednf install -y clang-develinCIBW_BEFORE_ALL_LINUX(clang-libsalone has only the versioned soname).PYMUPDF_SETUP_SWIG=swig— reuse the manylinux image's swig 4.4.1 instead ofcompiling the
swigsdist in-container.XCFLAGS/XCXXFLAGS=-D__LITTLE_ENDIAN__— mupdf'sscripts/tesseract/endianness.hdetects byte order purely fromarch-specific predefines (
__AARCH64EL__,_M_X64, …) and has no riscv64case, so it hard-errors with
#error "I don't know what architecture this is!". Verified locally in the manylinux riscv64 image.Matrix
Upstream publishes exactly two Linux wheel shapes:
cp310-abi3andcp314-cp314t. cp312 is our floor, so the abi3 wheel is built there;the free-threaded build sets
PYMUPDF_SETUP_PY_LIMITED_API=0because pipclasserts
Py_LIMITED_APIandPy_GIL_DISABLEDcannot be combined.Tests
Upstream's own harness (
tests/run_compound.py … pytest tests) with its testdeps, restricted to
-i r(the default implementation) — the defaultrRreruns the whole suite a second time with
PYMUPDF_USE_EXTRA=0.test_flake8/test_pylint/test_codespellare ignored: they lint thesource tree rather than exercise the wheel, and track whatever linter version
pip resolves today.