add script to build manylinux wheels in docker
authorSamuel Trégouët <samuel.tregouet@logilab.fr>
Thu, 12 Jul 2018 18:11:10 +0200
changeset 818 7f89d2d976e7
parent 817 5eab175af278
child 819 148f94dda768
add script to build manylinux wheels in docker
README
build_wheel.sh
--- a/README	Fri May 18 19:31:20 2018 +0200
+++ b/README	Thu Jul 12 18:11:10 2018 +0200
@@ -10,3 +10,13 @@
 building rql binary extension in place:
 
 python setup.py build_ext --inplace
+
+BUILD
+-----
+
+To build a manylinux package for rql we use quay.io/pypa/manylinux1_x86_64
+docker image and a costum script `build_wheel.sh` so you just have to execute
+it and it will pull docker image and execute script in this imageĀ :
+
+  sh build_wheel.sh
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build_wheel.sh	Thu Jul 12 18:11:10 2018 +0200
@@ -0,0 +1,38 @@
+#!/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/
+