Skip to content

setup.py: use PYMUPDF_MUPDF_LIB when building with system MuPDF - #5197

Open
benmoss wants to merge 1 commit into
pymupdf:mainfrom
benmoss:fix-pymupdf-mupdf-lib
Open

benmoss wants to merge 1 commit into
pymupdf:mainfrom
benmoss:fix-pymupdf-mupdf-lib

Conversation

@benmoss

@benmoss benmoss commented Oct 20, 2026

Copy link
Copy Markdown

In 2.0, _extension_flags() no longer reads PYMUPDF_MUPDF_LIB, although the docstring at the top of setup.py still documents it and 1.28.0 used it. When building against system MuPDF (PYMUPDF_SETUP_MUPDF_BUILD=), libpaths is therefore None.

On Linux the build still works if LDFLAGS has the right -L. On macOS, pipcl.build_extension() calls macos_patch2(path_so, libpaths, libs) after linking, and that fails:

  File "$SRC_DIR/setup.py", line 614, in build
    path_so_leaf = pipcl.build_extension(
  File ".../pipcl/__init__.py", line 2151, in build_extension
    macos_patch2(path_so, libpaths, libs)
  File ".../pipcl/__init__.py", line 2534, in macos_patch2
    for libpath in libpaths:
TypeError: 'NoneType' object is not iterable

This PR restores the 1.28.0 behaviour: with system MuPDF, libpaths comes from colon-separated PYMUPDF_MUPDF_LIB and libraries is None. Behaviour when mupdf_lib is set is unchanged.

Seen and verified in the conda-forge build of 2.0, which applies the same change as a patch: macOS builds went from failing to passing (conda-forge/pymupdf-feedstock#60).

🤖 Generated with Claude Code

…h system MuPDF.

This was handled in 1.28.0 and is still documented at the top of setup.py, but was lost in 2.0. Without it libpaths is None with system MuPDF, and on MacOS pipcl.macos_patch2() fails with TypeError: 'NoneType' object is not iterable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant