diff --git a/tools/build-wheels.sh b/tools/build-wheels.sh index e5d744b2a86..66f8bb191a2 100755 --- a/tools/build-wheels.sh +++ b/tools/build-wheels.sh @@ -13,6 +13,11 @@ fi export WORKDIR_PATH="${GITHUB_WORKSPACE:-/io}" +BUILD_DIR=`mktemp -d "/tmp/${package_name}-manylinux1-build.XXXXXXXXXX"` +ORIG_WHEEL_DIR="${BUILD_DIR}/original-wheelhouse" +SRC_DIR="${BUILD_DIR}/src" +WHEELHOUSE_DIR="${WORKDIR_PATH}/dist" + set -euo pipefail # ref: https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail @@ -23,6 +28,16 @@ export PYTHONDONTWRITEBYTECODE=1 arch=`uname -m` +echo +echo +echo "Copying source to ${SRC_DIR}..." +cp -a "${WORKDIR_PATH}" "${SRC_DIR}" + +echo +echo +echo "Removing pre-existing ${SRC_DIR}/dist..." +rm -rfv "${SRC_DIR}/dist" + echo echo echo "Building ${package_name} dist has been requested" @@ -33,32 +48,32 @@ echo "Compile wheels" for PYTHON in ${PYTHON_VERSIONS}; do /opt/python/${PYTHON}/bin/pip install -r "${WORKDIR_PATH}/requirements/cython.txt" /opt/python/${PYTHON}/bin/pip install -r "${WORKDIR_PATH}/requirements/wheel.txt" - /opt/python/${PYTHON}/bin/pip wheel "${WORKDIR_PATH}/" -w "${WORKDIR_PATH}/dist/" + /opt/python/${PYTHON}/bin/pip wheel "${SRC_DIR}/" --no-deps -w "${ORIG_WHEEL_DIR}/${PYTHON}" -v done echo echo echo "Bundle external shared libraries into the wheels" -for whl in ${WORKDIR_PATH}/dist/${package_name}-*-linux_${arch}.whl; do +for whl in ${ORIG_WHEEL_DIR}/*/${package_name}-*-linux_${arch}.whl; do echo "Repairing $whl..." - auditwheel repair "$whl" -w "${WORKDIR_PATH}/dist/" + auditwheel repair "$whl" -w "${WHEELHOUSE_DIR}" done echo echo echo "Cleanup OS specific wheels" -rm -fv ${WORKDIR_PATH}/dist/*-linux_*.whl +rm -fv ${WHEELHOUSE_DIR}/*-linux_*.whl echo echo echo "Cleanup non-$package_name wheels" -find "${WORKDIR_PATH}/dist" -maxdepth 1 -type f ! -name "$package_name"'-*-manylinux1_*.whl' -print0 | xargs -0 rm -rf +find "${WHEELHOUSE_DIR}" -maxdepth 1 -type f ! -name "$package_name"'-*-manylinux1_*.whl' -print0 | xargs -0 rm -rf echo echo echo "Install packages and test" echo "dist directory:" -ls ${WORKDIR_PATH}/dist +ls ${WHEELHOUSE_DIR} for PYTHON in ${PYTHON_VERSIONS}; do # clear python cache @@ -69,6 +84,8 @@ for PYTHON in ${PYTHON_VERSIONS}; do /opt/python/${PYTHON}/bin/python -c "import platform; print('Building wheel for {platform} platform.'.format(platform=platform.platform()))" /opt/python/${PYTHON}/bin/pip install -r ${WORKDIR_PATH}/requirements/cython.txt /opt/python/${PYTHON}/bin/pip install -r ${WORKDIR_PATH}/requirements/ci-wheel.txt - /opt/python/${PYTHON}/bin/pip install "$package_name" --no-index -f "file://${WORKDIR_PATH}/dist" + /opt/python/${PYTHON}/bin/pip install "$package_name" --no-index -f "file://${WHEELHOUSE_DIR}" /opt/python/${PYTHON}/bin/py.test ${WORKDIR_PATH}/tests done + +chown -R --reference="${WORKDIR_PATH}/.travis.yml" "${WORKDIR_PATH}"