Skip to content

Commit 90d5dfa

Browse files
committed
🎨 Teach wheel build script about custom build dir
1 parent ba2af54 commit 90d5dfa

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

tools/build-wheels.sh

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ if [ -n "$DEBUG" ]
33
then
44
set -x
55
fi
6-
set -euo pipefail
7-
# ref: https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail
8-
9-
PYTHON_VERSIONS="cp35-cp35m cp36-cp36m cp37-cp37m"
10-
11-
# Avoid creation of __pycache__/*.py[c|o]
12-
export PYTHONDONTWRITEBYTECODE=1
136

147
package_name="$1"
158
if [ -z "$package_name" ]
@@ -18,6 +11,16 @@ then
1811
exit 1
1912
fi
2013

14+
export WORKDIR_PATH="${GITHUB_WORKSPACE:-/io}"
15+
16+
set -euo pipefail
17+
# ref: https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail
18+
19+
PYTHON_VERSIONS="cp35-cp35m cp36-cp36m cp37-cp37m"
20+
21+
# Avoid creation of __pycache__/*.py[c|o]
22+
export PYTHONDONTWRITEBYTECODE=1
23+
2124
arch=`uname -m`
2225

2326
echo
@@ -28,44 +31,44 @@ echo
2831
echo
2932
echo "Compile wheels"
3033
for PYTHON in ${PYTHON_VERSIONS}; do
31-
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/cython.txt
32-
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/wheel.txt
33-
/opt/python/${PYTHON}/bin/pip wheel /io/ -w /io/dist/
34+
/opt/python/${PYTHON}/bin/pip install -r "${WORKDIR_PATH}/requirements/cython.txt"
35+
/opt/python/${PYTHON}/bin/pip install -r "${WORKDIR_PATH}/requirements/wheel.txt"
36+
/opt/python/${PYTHON}/bin/pip wheel "${WORKDIR_PATH}/" -w "${WORKDIR_PATH}/io/dist/"
3437
done
3538

3639
echo
3740
echo
3841
echo "Bundle external shared libraries into the wheels"
39-
for whl in /io/dist/${package_name}-*-linux_${arch}.whl; do
42+
for whl in ${WORKDIR_PATH}/dist/${package_name}-*-linux_${arch}.whl; do
4043
echo "Repairing $whl..."
41-
auditwheel repair "$whl" -w /io/dist/
44+
auditwheel repair "$whl" -w "${WORKDIR_PATH}/dist/"
4245
done
4346

4447
echo
4548
echo
4649
echo "Cleanup OS specific wheels"
47-
rm -fv /io/dist/*-linux_*.whl
50+
rm -fv ${WORKDIR_PATH}/dist/*-linux_*.whl
4851

4952
echo
5053
echo
5154
echo "Cleanup non-$package_name wheels"
52-
find /io/dist -maxdepth 1 -type f ! -name "$package_name"'-*-manylinux1_*.whl' -print0 | xargs -0 rm -rf
55+
find "${WORKDIR_PATH}/dist" -maxdepth 1 -type f ! -name "$package_name"'-*-manylinux1_*.whl' -print0 | xargs -0 rm -rf
5356

5457
echo
5558
echo
5659
echo "Install packages and test"
5760
echo "dist directory:"
58-
ls /io/dist
61+
ls ${WORKDIR_PATH}/dist
5962

6063
for PYTHON in ${PYTHON_VERSIONS}; do
6164
# clear python cache
62-
find /io -type d -name __pycache__ -print0 | xargs -0 rm -rf
65+
find "${WORKDIR_PATH}" -type d -name __pycache__ -print0 | xargs -0 rm -rf
6366

6467
echo
6568
echo -n "Test $PYTHON: "
6669
/opt/python/${PYTHON}/bin/python -c "import platform; print('Building wheel for {platform} platform.'.format(platform=platform.platform()))"
67-
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/cython.txt
68-
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/ci-wheel.txt
69-
/opt/python/${PYTHON}/bin/pip install "$package_name" --no-index -f file:///io/dist
70-
/opt/python/${PYTHON}/bin/py.test /io/tests
70+
/opt/python/${PYTHON}/bin/pip install -r ${WORKDIR_PATH}/requirements/cython.txt
71+
/opt/python/${PYTHON}/bin/pip install -r ${WORKDIR_PATH}/requirements/ci-wheel.txt
72+
/opt/python/${PYTHON}/bin/pip install "$package_name" --no-index -f "file://${WORKDIR_PATH}/dist"
73+
/opt/python/${PYTHON}/bin/py.test ${WORKDIR_PATH}/tests
7174
done

0 commit comments

Comments
 (0)