1#!/bin/bash 2 3set -eux 4 5# doesn't really matter which Python we use, so long as it can run cibuildwheels, and we're consistent within the 6# build, since cibuildwheel is internally managing looping over all the Pythons for us. 7export PYBIN=/usr/bin/python3 8 9${PYBIN} -V 10${PYBIN} -m pip install -U --user cibuildwheel 11# run cibuildwheel; we can skip CIBW_ENVIRONMENT since the Mac version will directly inherit the envvars we set to 12# force Cython and --with-libyaml. cibuildwheel will install Cython before each version is built. We expect that 13# the calling environment will set CIBW_SKIP or CIBW_BUILD to control which Pythons we build for. (eg, CIBW_SKIP='pp* cp27* cp35*') 14 15# we're using a private build of libyaml, so set paths to favor that instead of whatever's laying around 16export C_INCLUDE_PATH=$(cd libyaml/include; pwd):${C_INCLUDE_PATH:-} 17export LIBRARY_PATH=$(cd libyaml/src/.libs; pwd):${LIBRARY_PATH:-} 18export LD_LIBRARY_PATH=$(cd libyaml/src/.libs; pwd):${LD_LIBRARY_PATH:-} 19 20export PYYAML_FORCE_CYTHON=1 21export PYYAML_FORCE_LIBYAML=1 22 23if [[ ${PYYAML_RUN_TESTS:-1} -eq 1 ]]; then 24 # tweak CIBW behavior to run our tests for us 25 export CIBW_BEFORE_BUILD='pip install Cython && make testall PYTHON=python' 26else 27 echo "skipping test suite..." 28fi 29 30export CIBW_TEST_COMMAND='python {project}/packaging/build/smoketest.py' 31 32${PYBIN} -m cibuildwheel --platform macos . 33 34mkdir -p dist 35mv wheelhouse/* dist/ 36 37# ensure exactly one artifact 38shopt -s nullglob 39DISTFILES=(dist/*.whl) 40if [[ ${#DISTFILES[@]} -ne 1 ]]; then 41 echo -e "unexpected dist content:\n\n$(ls)" 42 exit 1 43fi 44