Skip to content

Commit c9bb40b

Browse files
authored
Merge pull request #284 from SimonRit/disk-usage
ENH: Only extract required directories from the ITKPythonBuilds tar
2 parents 601dccf + ca1a7e5 commit c9bb40b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

scripts/macpython-download-cache-and-build-module-wheels.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,27 @@ else
4848
tarball_arch=""
4949
fi
5050
# Fetch ITKPythonBuilds archive containing ITK build artifacts
51+
rm -fr ITKPythonPackage
5152
echo "Fetching https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.4.0}/ITKPythonBuilds-macosx${tarball_arch}.tar.zst"
5253
if [[ ! -f ITKPythonBuilds-macosx${tarball_arch}.tar.zst ]]; then
5354
aria2c -c --file-allocation=none -o ITKPythonBuilds-macosx${tarball_arch}.tar.zst -s 10 -x 10 https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.4.0}/ITKPythonBuilds-macosx${tarball_arch}.tar.zst
5455
fi
5556
unzstd --long=31 ITKPythonBuilds-macosx${tarball_arch}.tar.zst -o ITKPythonBuilds-macosx${tarball_arch}.tar
5657
PATH="$(dirname $(brew list gnu-tar | grep gnubin)):$PATH"
57-
gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --checkpoint=10000 --checkpoint-action=dot
58+
gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --checkpoint=10000 --checkpoint-action=dot \
59+
ITKPythonPackage/ITK-source \
60+
ITKPythonPackageRequiredExtractionDir.txt \
61+
ITKPythonPackage/scripts
62+
63+
# Extract subdirectories specific to the compiled python versions
64+
args=( "$@" )
65+
source ITKPythonPackage/scripts/macpython-build-common.sh
66+
for version in "$PYTHON_VERSIONS"; do
67+
gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --checkpoint=10000 --checkpoint-action=dot \
68+
--wildcards "ITKPythonPackage/ITK-${version}-macosx*" \
69+
"ITKPythonPackage/venvs/${version}"
70+
done
71+
5872
rm ITKPythonBuilds-macosx${tarball_arch}.tar
5973

6074
# Optional: Update build scripts
@@ -82,4 +96,4 @@ if [[ ! ${ITK_USE_LOCAL_PYTHON} ]]; then
8296
fi
8397

8498
echo "Building module wheels"
85-
/Users/svc-dashboard/D/P/ITKPythonPackage/scripts/macpython-build-module-wheels.sh "$@"
99+
/Users/svc-dashboard/D/P/ITKPythonPackage/scripts/macpython-build-module-wheels.sh "${args[@]}"

0 commit comments

Comments
 (0)