Skip to content

Commit 1b1ccaf

Browse files
committed
Add wheel builder script
1 parent 161a35d commit 1b1ccaf

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

build-wheels.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
# Based on https://github.com/pypa/python-manylinux-demo/blob/master/travis/build-wheels.sh
3+
# Build steps:
4+
# sudo rm -r getdents.egg-info build getdents/*.so
5+
# docker run -it --rm -v `pwd`:/io -w /io -e PLAT=manylinux_2_28_x86_64 quay.io/pypa/manylinux_2_28_x86_64
6+
# docker run -it --rm -v `pwd`:/io -w /io -e PLAT=musllinux_1_2_x86_64 quay.io/pypa/musllinux_1_2_x86_64
7+
set -e -u -x
8+
export WORKDIR=/io
9+
export WHEELHOUSE="$WORKDIR/wheelhouse/"
10+
11+
function repair_wheel {
12+
wheel="$1"
13+
if ! auditwheel show "$wheel"; then
14+
echo "Skipping non-platform wheel $wheel"
15+
else
16+
auditwheel repair "$wheel" --plat "$PLAT" -w "$WHEELHOUSE"
17+
fi
18+
}
19+
20+
if command -v yum &> /dev/null; then
21+
yum install -y git
22+
fi
23+
24+
if command -v apk &> /dev/null; then
25+
# seems like musllinux image does not contain gcc
26+
apk add build-base git
27+
fi
28+
29+
for PYBIN in /opt/python/*/bin; do
30+
if [[ $PYBIN =~ [cp]p3[67]\- ]]; then
31+
continue
32+
fi
33+
34+
"${PYBIN}/pip" wheel "$WORKDIR" --no-deps -w "$WHEELHOUSE"
35+
done
36+
37+
for whl in "$WHEELHOUSE"/*-linux_x86_64.whl; do
38+
repair_wheel "$whl"
39+
rm "$whl"
40+
done
41+
42+
for PYBIN in /opt/python/*/bin; do
43+
if [[ $PYBIN =~ [cp]p3[67]\- ]]; then
44+
continue
45+
fi
46+
47+
# https://github.com/pypa/pip/issues/11440
48+
"${PYBIN}/pip" install pytest pytest-cov
49+
"${PYBIN}/pip" install getdents --only-binary ":all:" --no-index -f "$WHEELHOUSE"
50+
(cd "$WORKDIR"; "${PYBIN}/py.test" -p no:cacheprovider)
51+
done

0 commit comments

Comments
 (0)