1#!/bin/bash 2# This file is directly inspired by 3# https://github.com/pypa/python-manylinux-demo/blob/master/travis/build-wheels.sh 4set -e -x 5 6PYTHON_TARGETS=$(ls -d /opt/python/cp27*/bin) 7 8# Create an user for the tests 9useradd hgbuilder 10 11# Bypass uid/gid problems 12cp -R /src /io && chown -R hgbuilder:hgbuilder /io 13 14# Compile wheels for Python 2.X 15for PYBIN in $PYTHON_TARGETS; do 16 "${PYBIN}/pip" wheel /io/ -w wheelhouse/ 17done 18 19# Bundle external shared libraries into the wheels with 20# auditwheel (https://github.com/pypa/auditwheel) repair. 21# It also fix the ABI tag on the wheel making it pip installable. 22for whl in wheelhouse/*.whl; do 23 auditwheel repair "$whl" -w /src/wheelhouse/ 24done 25 26# Install packages and run the tests for all Python versions 27cd /io/tests/ 28 29for PYBIN in $PYTHON_TARGETS; do 30 # Install mercurial wheel as root 31 "${PYBIN}/pip" install mercurial --no-index -f /src/wheelhouse 32 # But run tests as hgbuilder user (non-root) 33 su hgbuilder -c "\"${PYBIN}/python\" /io/tests/run-tests.py --with-hg=\"${PYBIN}/hg\" --blacklist=/io/contrib/packaging/linux-wheel-centos5-blacklist" 34done 35