Skip to content

Commit 4605520

Browse files
committed
optimize build-wheels.sh
1 parent 4ae80d6 commit 4605520

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

tools/build-wheels.sh

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -e -o pipefail
33
PYTHON_VERSIONS="cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310"
44

55
# Avoid creation of __pycache__/*.py[c|o]
@@ -28,38 +28,32 @@ cd /io
2828
for PYTHON in ${PYTHON_VERSIONS}; do
2929
echo "Python ${PYTHON} ${arch}:"
3030
python_bin="/opt/python/${PYTHON}/bin"
31-
"$python_bin/pip" install -U pip setuptools auditwheel
32-
"$python_bin/pip" install -r /io/build_requirements.txt
33-
"$python_bin/pip" wheel /io/ -w /io/dist/
31+
pip="$python_bin/pip"
32+
"$pip" install -U pip setuptools auditwheel
33+
"$pip" install -r /io/build_requirements.txt
34+
"$pip" wheel /io/ -w /io/dist/
3435
"$python_bin/python" setup.py bdist_wheel clean
3536

3637
wheels=(/io/dist/"${package_name}"*"${PYTHON}"*linux_"${arch}".whl)
3738
for whl in "${wheels[@]}"; do
3839
echo "Repairing $whl..."
39-
"$python_bin/python" -m auditwheel repair "$whl" -w /io/dist/
40-
echo "Cleanup OS specific wheels"
41-
rm -fv "$whl"
40+
if "$python_bin/python" -m auditwheel repair "$whl" -w /io/dist/; then
41+
echo
42+
echo "Cleanup OS specific wheels"
43+
rm -fv "$whl"
44+
else
45+
auditwheel show "$whl"
46+
exit 1
47+
fi
4248
done
4349
echo
44-
done
45-
46-
echo
47-
echo "Cleanup OS specific wheels"
48-
rm -fv /io/dist/*-linux_*.whl
49-
50-
echo
51-
echo
52-
echo "Install packages and test"
53-
echo "dist directory:"
54-
ls /io/dist
55-
echo
50+
echo
5651

57-
for PYTHON in ${PYTHON_VERSIONS}; do
5852
echo -n "Test $PYTHON ${arch}: $package_name "
59-
python_bin="/opt/python/${PYTHON}/bin"
6053
"$python_bin/python" -c "import platform;print(platform.platform())"
61-
"$python_bin/pip" install "$package_name" --no-index -f file:///io/dist
62-
"$python_bin/pip" install -r /io/pytest_requirements.txt
54+
"$pip" install "$package_name" --no-index -f file:///io/dist
55+
"$pip" install -r /io/pytest_requirements.txt
56+
echo
6357
"$python_bin/py.test" -vvv /io/test
6458
echo
6559
done

0 commit comments

Comments
 (0)