Skip to content

Commit af559dc

Browse files
setup.py: fixed handling of --clean if mupdf is not within pymupdf checkout.
1 parent 3a01de2 commit af559dc

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

setup.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,14 +1218,19 @@ def clean(all_):
12181218
ret.append(f'{g_root}/src/build')
12191219

12201220
path_mupdf, _ = get_mupdf()
1221-
ret.append(f'{path_mupdf}/platform/c++')
1222-
ret.append(f'{path_mupdf}/platform/python')
1221+
1222+
# We remove mupdf directories directly with shutil.rmtree() instead of
1223+
# returning them to pipcl, because pipcl will deliberately fail if asked to
1224+
# remove things that are outside our checkout.
1225+
shutil.rmtree(f'{path_mupdf}/platform/c++', ignore_errors=True)
1226+
shutil.rmtree(f'{path_mupdf}/platform/python', ignore_errors=True)
1227+
12231228
if all_:
12241229
# Clean mupdf C library.
1225-
ret.append(f'{path_mupdf}/build')
1226-
ret.append(f'{path_mupdf}/platform/win32')
1227-
ret.append(f'{path_mupdf}/platform/win32/Release')
1228-
ret.append(f'{path_mupdf}/platform/win32/x64')
1230+
shutil.rmtree(f'{path_mupdf}/build', ignore_errors=True)
1231+
shutil.rmtree(f'{path_mupdf}/platform/win32', ignore_errors=True)
1232+
shutil.rmtree(f'{path_mupdf}/platform/win32/Release', ignore_errors=True)
1233+
shutil.rmtree(f'{path_mupdf}/platform/win32/x64', ignore_errors=True)
12291234

12301235
pipcl.log(f'Returning: {ret=}')
12311236
return ret
@@ -1441,6 +1446,7 @@ def platform_release_tuple():
14411446
elif darwin or os.environ.get('PYODIDE_ROOT'):
14421447
# 2025-10-27: new swig-4.4.0 fails badly at runtime on macos.
14431448
# 2025-11-06: similar for pyodide.
1449+
# 2026-02-24: Stil fails badly on macos with swig 4.4.1.
14441450
ret.append('swig==4.3.1')
14451451
else:
14461452
ret.append('swig')

0 commit comments

Comments
 (0)