diff --git a/setup.py b/setup.py index d09be30cf..ff037a496 100755 --- a/setup.py +++ b/setup.py @@ -1218,14 +1218,19 @@ def clean(all_): ret.append(f'{g_root}/src/build') path_mupdf, _ = get_mupdf() - ret.append(f'{path_mupdf}/platform/c++') - ret.append(f'{path_mupdf}/platform/python') + + # We remove mupdf directories directly with shutil.rmtree() instead of + # returning them to pipcl, because pipcl will deliberately fail if asked to + # remove things that are outside our checkout. + shutil.rmtree(f'{path_mupdf}/platform/c++', ignore_errors=True) + shutil.rmtree(f'{path_mupdf}/platform/python', ignore_errors=True) + if all_: # Clean mupdf C library. - ret.append(f'{path_mupdf}/build') - ret.append(f'{path_mupdf}/platform/win32') - ret.append(f'{path_mupdf}/platform/win32/Release') - ret.append(f'{path_mupdf}/platform/win32/x64') + shutil.rmtree(f'{path_mupdf}/build', ignore_errors=True) + shutil.rmtree(f'{path_mupdf}/platform/win32', ignore_errors=True) + shutil.rmtree(f'{path_mupdf}/platform/win32/Release', ignore_errors=True) + shutil.rmtree(f'{path_mupdf}/platform/win32/x64', ignore_errors=True) pipcl.log(f'Returning: {ret=}') return ret @@ -1438,9 +1443,10 @@ def platform_release_tuple(): print(f'OpenBSD: pip install of swig does not build; assuming `pkg_add swig`.') elif PYMUPDF_SETUP_SWIG: pass - elif darwin or os.environ.get('PYODIDE_ROOT'): + elif os.environ.get('PYODIDE_ROOT'): # 2025-10-27: new swig-4.4.0 fails badly at runtime on macos. # 2025-11-06: similar for pyodide. + # 2026-02-24: Appears to work on macos with swig 4.4.1. ret.append('swig==4.3.1') else: ret.append('swig') diff --git a/tests/conftest.py b/tests/conftest.py index 44c5e4d02..c79e69906 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,6 +38,11 @@ def install_required_packages(): install_required_packages() + +@pytest.fixture(scope="session", autouse=True) +def log_global_env_facts(record_testsuite_property): + record_testsuite_property('platform.python_version()', platform.python_version()) + # Need to import pymupdf only after we've installed pymupdf-fonts above, # because pymupdf imports pymupdf_fonts, and copes with import failure. import pymupdf