Skip to content

Commit 037a326

Browse files
committed
ENH: Build macOS module wheels with TBB support
1 parent 5ab4922 commit 037a326

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
diff -uNr ../itk_numerics-5.2.1.dev20210824-cp39-cp39-macosx_10_9_x86_64/itk/__init__.py ./itk/__init__.py
2+
--- ../itk_numerics-5.2.1.dev20210824-cp39-cp39-macosx_10_9_x86_64/itk/__init__.py 1969-12-31 19:00:00.000000000 -0500
3+
+++ ./itk/__init__.py 2021-09-08 21:11:35.000000000 -0400
4+
@@ -0,0 +1 @@
5+
+from . import *
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
diff -uNr ./itk/__init__.py ../itk_numerics-5.2.1.dev20210824-cp39-cp39-macosx_10_9_x86_64/itk/__init__.py
2+
--- ./itk/__init__.py 2021-09-08 21:11:35.000000000 -0400
3+
+++ ../itk_numerics-5.2.1.dev20210824-cp39-cp39-macosx_10_9_x86_64/itk/__init__.py 1969-12-31 19:00:00.000000000 -0500
4+
@@ -1 +0,0 @@
5+
-from . import *

scripts/macpython-build-module-wheels.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Python3_EXECUTABLE=${VENV}/bin/python3
2525
${Python3_EXECUTABLE} -m pip install --no-cache delocate
2626
DELOCATE_LISTDEPS=${VENV}/bin/delocate-listdeps
2727
DELOCATE_WHEEL=${VENV}/bin/delocate-wheel
28+
# So delocate can find the libs
29+
export DYLD_LIBRARY_PATH=${script_dir}/../oneTBB-prefix/lib
2830

2931
# Compile wheels re-using standalone project and archive cache
3032
for VENV in "${VENVS[@]}"; do
@@ -67,5 +69,9 @@ for VENV in "${VENVS[@]}"; do
6769
${Python3_EXECUTABLE} setup.py clean
6870
done
6971

70-
${DELOCATE_LISTDEPS} $PWD/dist/*.whl # lists library dependencies
71-
${DELOCATE_WHEEL} $PWD/dist/*.whl # copies library dependencies into wheel
72+
for wheel in $PWD/dist/*.whl; do
73+
${DELOCATE_PATCH} $wheel ${script_dir}/delocate.package.apply.patch # workaround for delocate's need for a package
74+
${DELOCATE_LISTDEPS} $wheel # lists library dependencies
75+
${DELOCATE_WHEEL} $wheel # copies library dependencies into wheel
76+
${DELOCATE_PATCH} $wheel ${script_dir}/delocate.package.revert.patch # workaround for delocate's need for a package
77+
done

scripts/macpython-build-wheels.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Python3_EXECUTABLE=${VENV}/bin/python3
3939
${Python3_EXECUTABLE} -m pip install --no-cache delocate
4040
DELOCATE_LISTDEPS=${VENV}/bin/delocate-listdeps
4141
DELOCATE_WHEEL=${VENV}/bin/delocate-wheel
42+
DELOCATE_PATCH=${VENV}/bin/delocate-patch
4243

4344
# Build standalone project and populate archive cache
4445
tbb_dir=$PWD/oneTBB-prefix/lib/cmake/TBB
@@ -181,8 +182,18 @@ for VENV in "${VENVS[@]}"; do
181182
find ${build_path} -name '*.o' -delete
182183
done
183184

184-
${DELOCATE_LISTDEPS} ${SCRIPT_DIR}/../dist/*.whl # lists library dependencies
185-
${DELOCATE_WHEEL} ${SCRIPT_DIR}/../dist/*.whl # copies library dependencies into wheel
185+
for wheel in dist/*.whl; do
186+
echo "Delocating $wheel"
187+
if [[ $wheel = *itk_core* ]]; then
188+
${DELOCATE_LISTDEPS} $wheel # lists library dependencies
189+
${DELOCATE_WHEEL} $wheel # copies library dependencies into wheel
190+
else
191+
${DELOCATE_PATCH} $wheel ${SCRIPT_DIR}/delocate.package.apply.patch # workaround for delocate's need for a package
192+
${DELOCATE_LISTDEPS} $wheel # lists library dependencies
193+
${DELOCATE_WHEEL} $wheel # copies library dependencies into wheel
194+
${DELOCATE_PATCH} $wheel ${SCRIPT_DIR}/delocate.package.revert.patch # workaround for delocate's need for a package
195+
fi
196+
done
186197

187198
# Install packages and test
188199
# numpy wheel not currently available for the M1

0 commit comments

Comments
 (0)