1#!/bin/bash 2# From: https://github.com/pypa/python-manylinux-demo/blob/master/travis/build-wheels.sh 3# which is in the public domain. 4# 5# This is run inside a CentOS 5 virtual machine to build manylinux wheels: 6# 7# $ docker run -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/ci/build_manylinux.sh 8# 9 10set -e -x 11 12action=$1 13shift 14 15if [[ $action == "build" ]]; then 16 # Compile wheels 17 cd /io 18 for PYBIN in /opt/python/*/bin; do 19 if [[ $PYBIN == *cp34* ]]; then 20 # manylinux docker images have Python 3.4, but we don't use it. 21 continue 22 fi 23 "$PYBIN/pip" install -r requirements/wheel.pip 24 "$PYBIN/python" setup.py clean -a 25 "$PYBIN/python" setup.py bdist_wheel -d ~/wheelhouse/ 26 done 27 cd ~ 28 29 # Bundle external shared libraries into the wheels 30 for whl in wheelhouse/*.whl; do 31 auditwheel repair "$whl" -w /io/dist/ 32 done 33 34elif [[ $action == "test" ]]; then 35 # Create "pythonX.Y" links 36 for PYBIN in /opt/python/*/bin/; do 37 if [[ $PYBIN == *cp34* ]]; then 38 # manylinux docker images have Python 3.4, but we don't use it. 39 continue 40 fi 41 PYNAME=$("$PYBIN/python" -c "import sys; print('python{0[0]}.{0[1]}'.format(sys.version_info))") 42 ln -sf "$PYBIN/$PYNAME" /usr/local/bin/$PYNAME 43 done 44 45 # Install packages and test 46 TOXBIN=/opt/python/cp36-cp36m/bin 47 "$TOXBIN/pip" install -r /io/requirements/tox.pip 48 49 cd /io 50 export PYTHONPYCACHEPREFIX=/opt/pyc 51 if [[ $1 == "meta" ]]; then 52 shift 53 export COVERAGE_COVERAGE=yes 54 fi 55 TOXWORKDIR=.tox/linux "$TOXBIN/tox" "$@" || true 56 cd ~ 57 58else 59 echo "Need an action to perform!" 60fi 61