Skip to content

Commit d2b61db

Browse files
jcfrhenryiiithewtex
committed
BUG: Fix macOS itk wheel size explicitly removing _skbuild directory
This commit works around an issue with the "clean" command (see [1]) that was not properly considering the current MACOSX_DEPLOYMENT_TARGET env. variable. It does by explicitly deleting the scikit-build directory without relying on the "setup.py clean" command not respecting the selected deployment target. Considering that 1. the libraries installed while building the dependent itk-* wheels were accumulated in the install directory (e.g `_skbuild/macosx-X.Y-<arch>-3.9/setuptools/lib`) 2. the wheel is generated by systematically archiving the content of the install directory. The manifest files are used to select which file to "copy" into the install directory but these are not used by the function creating the wheel archive. See [2] 3. following scikit-build/scikit-build@ac9648bf4 (post 0.8.1), the platform name was properly considered on macOS *only* when building the wheel (using "setup.py build") but not when cleaning the build directory (using "setup.py clean") ... all the wheels depending on "itk-core" where unexpectedly large because there are including the cumulative set of files from all the wheels built beforehand. [1] scikit-build/scikit-build#1012 [2] https://github.com/pypa/wheel/blob/0.40.0/src/wheel/wheelfile.py#L121-L141 Co-authored-by: Henry Schreiner <[email protected]> Co-authored-by: Matt McCormick <[email protected]>
1 parent 3ebea79 commit d2b61db

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

scripts/macpython-build-common.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ for PYBIN in "${PYBINARIES[@]}"; do
6969
VENVS+=(${VENV})
7070
done
7171

72+
# -----------------------------------------------------------------------
73+
SKBUILD_DIR=_skbuild
74+
75+
7276
# -----------------------------------------------------------------------
7377
# Ensure that requirements are met
7478
brew update

scripts/macpython-build-module-wheels.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ fi
5252
# * PYTHON_VERSIONS
5353
# * NINJA_EXECUTABLE
5454
# * SCRIPT_DIR
55+
# * SKBUILD_DIR
5556
# * VENVS=()
5657

5758
MACPYTHON_PY_PREFIX=""
@@ -113,7 +114,7 @@ for VENV in "${VENVS[@]}"; do
113114
-DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
114115
${CMAKE_OPTIONS} \
115116
|| exit 1
116-
# ${Python3_EXECUTABLE} setup.py clean # Permission denied
117+
# rm -r ${SKBUILD_DIR} # Permission denied
117118
done
118119

119120
for wheel in $PWD/dist/*.whl; do

scripts/macpython-build-wheels.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# * PYTHON_VERSIONS
2727
# * NINJA_EXECUTABLE
2828
# * SCRIPT_DIR
29+
# * SKBUILD_DIR
2930
# * VENVS=()
3031

3132
MACPYTHON_PY_PREFIX=""
@@ -145,7 +146,7 @@ for VENV in "${VENVS[@]}"; do
145146
-DITK_WRAP_DOC:BOOL=ON \
146147
${CMAKE_OPTIONS}
147148
# Cleanup
148-
${Python3_EXECUTABLE} setup.py clean
149+
rm -r ${SKBUILD_DIR}
149150

150151
else
151152

@@ -208,7 +209,7 @@ for VENV in "${VENVS[@]}"; do
208209
${CMAKE_OPTIONS} \
209210
|| exit 1
210211
# Cleanup
211-
${Python3_EXECUTABLE} setup.py clean
212+
rm -r ${SKBUILD_DIR}
212213
done
213214

214215
fi

0 commit comments

Comments
 (0)