From 6bc9613d83f94e6c284e3eebceb7cd5605328f66 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Fri, 5 Sep 2025 14:30:12 +0100 Subject: [PATCH 1/4] pipcl.py: build_extension(): use rpath on Pyodide. Pyodide now supports rpath, so this allows us to place C/C++ libraries inside the package directory instead of at top level. --- pipcl.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pipcl.py b/pipcl.py index 8f4556e3b..4fee4fb65 100644 --- a/pipcl.py +++ b/pipcl.py @@ -1771,9 +1771,7 @@ def build_extension( # log0(f'pyodide: PEP-3149 suffix untested, so omitting. {_so_suffix()=}.') path_so_leaf = f'_{name}.so' - path_so = f'{outdir}/{path_so_leaf}' - - rpath_flag = '' + rpath_flag = "-Wl,-rpath,'$ORIGIN'" else: rpath_flag = "-Wl,-rpath,'$ORIGIN',-z,origin" path_so = f'{outdir}/{path_so_leaf}' From fee0dc9088af1f2b597a8578ee19a5a453341be0 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Fri, 5 Sep 2025 14:32:20 +0100 Subject: [PATCH 2/4] setup.py scripts/test.py: match pipcl.py's change to rpath with Pyodide. We now place C/C++ libraries inside package directory. --- scripts/test.py | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/test.py b/scripts/test.py index 1269b09f8..946328e89 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -967,7 +967,7 @@ def build(): # 2025-09-03: formally we put libraries in foo.lib; now it seems # they need to be at top level in wheel. # - (f'build/libqwerty.so', f'/'), + (f'build/libqwerty.so', f'foo/'), ] p = pipcl.Package( diff --git a/setup.py b/setup.py index cd5299607..fa8eece3f 100755 --- a/setup.py +++ b/setup.py @@ -700,8 +700,8 @@ def add(flavour, from_, to_): add('d', f'{mupdf_build_dir}/libmupdf-threads.a', f'{to_dir_d}/lib/') elif pyodide: add('p', f'{mupdf_build_dir}/_mupdf.so', to_dir) - add('b', f'{mupdf_build_dir}/libmupdfcpp.so', '/') - add('b', f'{mupdf_build_dir}/libmupdf.so', '/') + add('b', f'{mupdf_build_dir}/libmupdfcpp.so', to_dir) + add('b', f'{mupdf_build_dir}/libmupdf.so', to_dir) else: add('p', f'{mupdf_build_dir}/_mupdf.so', to_dir) add('b', pipcl.get_soname(f'{mupdf_build_dir}/libmupdfcpp.so'), to_dir) From db98053425e10ec65610bd8310e7777ad9d4a3ee Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Fri, 5 Sep 2025 17:31:19 +0100 Subject: [PATCH 3/4] scripts/test.py: on Pyodide, exit with error if pytest fails. In test() we now check that pytest.main() returns zero. --- scripts/test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/test.py b/scripts/test.py index 946328e89..8d9832e99 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -1297,7 +1297,8 @@ def getmtime(path): for arg in args: log(f' {arg!r}') import pytest - pytest.main(args) + e = pytest.main(args) + assert e == 0, f'pytest.main() failed: {e=}' return if venv >= 2: From fafb55e98f50aab257e4d280f0625795ba0bc938 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Fri, 5 Sep 2025 17:32:50 +0100 Subject: [PATCH 4/4] changes.txt: minor changes. --- changes.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/changes.txt b/changes.txt index 1ed7e8911..d06386a9a 100644 --- a/changes.txt +++ b/changes.txt @@ -11,14 +11,10 @@ Change Log * Partially address `2883 `_: Improve the Python type annotations for fitz_new We now define all class methods explicitly instead of with dynamic assignment. - * Removed `pymupdf.utils.Shape` class, was duplicate of `pymupdf.Shape`. - * Allow use of cibuildwheel to build and test on Pyodide. - * In documentation, added section about Linux wheels and glibc compatibility. - - * Retrospectively mark #4544 as fixed in 1.26.4. + * Retrospectively mark `4544 `_ as fixed in 1.26.4. **Changes in version 1.26.4** @@ -32,12 +28,12 @@ Change Log * **Fixed** `4457 `_: Wrong characters displayed after font subsetting (w/ native method) * **Fixed** `4462 `_: delete_pages() does not accept a single int * **Fixed** `4533 `_: Open PDF error segmentation fault + * **Fixed** `4544 `_: About pdf_clip_page * **Fixed** `4565 `_: MacOS uses Tesseract and not Tesseract-OCR * **Fixed** `4571 `_: Broken merged pdfs. * **Fixed** `4590 `_: TypeError in utils.py scrub(): annot.update_file(buffer=...) is invalid * **Fixed** `4614 `_: Intercept bad widgets when inserting to another PDF * **Fixed** `4639 `_: pymupdf.mupdf.FzErrorGeneric: code=1: Director error: : 'JM_new_bbox_device_Device' object has no attribute 'layer_name' - * **Fixed** `4544 `_: About pdf_clip_page * Other: