Skip to content

Commit 542ba0c

Browse files
authored
chore: clean-up finalize and ease re-use in other projects (#1685)
1 parent 9b67ad3 commit 542ba0c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docker/build_scripts/finalize.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ source $MY_DIR/build_utils.sh
1111

1212
# most people don't need libpython*.a, and they're many megabytes.
1313
# compress them all together for best efficiency
14-
pushd /opt/_internal
15-
XZ_OPT=-9e tar -cJf static-libs-for-embedding-only.tar.xz cpython-*/lib/libpython*.a
16-
popd
14+
if [ $(find /opt/_internal -path '/opt/_internal/cpython-*/lib/libpython*.a' | wc -l) -ne 0 ]; then
15+
pushd /opt/_internal
16+
XZ_OPT=-9e tar -cJf static-libs-for-embedding-only.tar.xz cpython-*/lib/libpython*.a
17+
popd
18+
fi
1719
find /opt/_internal -name '*.a' -print0 | xargs -0 rm -f
1820

1921
# disable some pip warnings
@@ -25,7 +27,7 @@ export PIP_CACHE_DIR=/tmp/pip_cache
2527

2628
# update package, create symlinks for each python
2729
mkdir /opt/python
28-
for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 \( -name 'cpython*' -o -name 'pypy*' \)); do
30+
for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 -name 'cpython*'); do
2931
${MY_DIR}/finalize-one.sh ${PREFIX}
3032
done
3133

@@ -81,8 +83,7 @@ pipx upgrade-shared --pip-args="--no-index --find-links=/tmp/pinned-wheels"
8183
for TOOL_PATH in $(find ${MY_DIR}/requirements-tools -type f); do
8284
TOOL=$(basename ${TOOL_PATH})
8385
case ${AUDITWHEEL_PLAT}-${TOOL} in
84-
musllinux*_armv7l-swig) apk add --no-cache swig;;
85-
musllinux*_armv7l-cmake) apk add --no-cache cmake;;
86+
musllinux*_armv7l-cmake|musllinux*_armv7l-swig) apk add --no-cache ${TOOL};;
8687
musllinux*_s390x-uv) continue;; # uv doesn't provide musl s390x wheels due to Rust issues
8788
*) pipx install --pip-args="--require-hashes -r ${TOOL_PATH} --only-binary" ${TOOL};;
8889
esac

0 commit comments

Comments
 (0)