build_wheel.sh
author Jérémy Bobbio <jeremy.bobbio@irq7.fr>
Tue, 04 Jun 2019 11:53:03 +0200
changeset 862 942ef0731f4c
parent 818 7f89d2d976e7
child 868 3ee87bec4482
permissions -rwxr-xr-x
Update Debian packaging Various improvements to Debian packaging: - Depend on python-yapps and python3-yapps for YAPPS runtime. - Use PYBUILD_NAME instead of debian/*.install files. - Use python3-sphinx instead of obsolete Python 2 version. - Always build Python 3 package. - Run tests at build time and adds relevant packages to Build-Depends. - Add superficial autopkgtest using autodep8. - Add autopkgtest script to run unittest against installed packages. - Add Vcs-Hg and Vcs-Browser fields. - Update Standards-Version to 4.3.0. In order to run the tests at build time and with autopkgtest, they need to be made part of the Python source package. The manifest has been modified accordingly.

#!/bin/sh

set -ex

mkdir -p dist
if ! test -e /.dockerenv; then
  exec docker run --rm -it -v $(pwd):/mnt/host/rql quay.io/pypa/manylinux1_x86_64 sh /mnt/host/rql/$0
fi

cd /mnt/host
VERSION=4.4.0
curl -L https://github.com/Gecode/gecode/archive/release-$VERSION.tar.gz | tar -xzf -
cd gecode-release-$VERSION
./configure
make -j2
make install

mkdir -p /wheelhouse
# Compile wheels
for PYBIN in /opt/python/*/bin; do
    "${PYBIN}/pip" wheel /mnt/host/rql -w /wheelhouse
done

# Bundle external shared libraries into the wheels
for whl in /wheelhouse/rql*.whl; do
    auditwheel repair "$whl" -w /wheelhouse
done

# Install packages and test
for PYBIN in /opt/python/*/bin/; do
    "${PYBIN}/pip" install pytest
    "${PYBIN}/pip" install rql --no-index -f /wheelhouse
    "${PYBIN}/python" -c 'import sys; assert sys.version_info[:2] == (2, 7)' && "${PYBIN}/pip" install unittest2
    echo "************  test on $PYBIN"
    (cd "/mnt/host"; "${PYBIN}/py.test" rql)
done
mv /wheelhouse/rql*manylinux*.whl /mnt/host/rql/dist/