diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -62,6 +62,9 @@ mercurial/mpatch.py mercurial/osutil.py mercurial/parsers.py +# Generated wheels +wheelhouse/ + syntax: regexp ^\.pc/ ^\.(pydev)?project diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -270,6 +270,14 @@ docker-centos7: mkdir -p packages/centos7 contrib/dockerrpm centos7 +linux-wheels: linux-wheels-x86_64 linux-wheels-i686 + +linux-wheels-x86_64: + docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/build-linux-wheels.sh + +linux-wheels-i686: + docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/build-linux-wheels.sh + .PHONY: help all local build doc cleanbutpackages clean install install-bin \ install-doc install-home install-home-bin install-home-doc \ dist dist-notests check tests check-code update-pot \ @@ -278,4 +286,5 @@ docker-centos7: docker-ubuntu-xenial docker-ubuntu-xenial-ppa \ docker-ubuntu-yakkety docker-ubuntu-yakkety-ppa \ fedora20 docker-fedora20 fedora21 docker-fedora21 \ - centos5 docker-centos5 centos6 docker-centos6 centos7 docker-centos7 + centos5 docker-centos5 centos6 docker-centos6 centos7 docker-centos7 \ + linux-wheels diff --git a/contrib/build-linux-wheels.sh b/contrib/build-linux-wheels.sh new file mode 100644 --- /dev/null +++ b/contrib/build-linux-wheels.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# This file is directly inspired by +# https://github.com/pypa/python-manylinux-demo/blob/master/travis/build-wheels.sh +set -e -x + +PYTHON_TARGETS=$(ls -d /opt/python/cp2*/bin) + +# Create an user for the tests +useradd hgbuilder + +# Bypass uid/gid problems +cp -R /src /io && chown -R hgbuilder:hgbuilder /io + +# Compile wheels for Python 2.X +for PYBIN in $PYTHON_TARGETS; do + "${PYBIN}/pip" wheel /io/ -w wheelhouse/ +done + +# Bundle external shared libraries into the wheels with +# auditwheel (https://github.com/pypa/auditwheel) repair. +# It also fix the ABI tag on the wheel making it pip installable. +for whl in wheelhouse/*.whl; do + auditwheel repair "$whl" -w /src/wheelhouse/ +done + +# Install packages and run the tests for all Python versions +cd /io/tests/ + +for PYBIN in $PYTHON_TARGETS; do + # Install mercurial wheel as root + "${PYBIN}/pip" install mercurial --no-index -f /src/wheelhouse + # But run tests as hgbuilder user (non-root) + su hgbuilder -c "\"${PYBIN}/python\" /io/tests/run-tests.py --with-hg=\"${PYBIN}/hg\" --blacklist=/io/contrib/linux-wheel-centos5-blacklist" +done diff --git a/contrib/linux-wheel-centos5-blacklist b/contrib/linux-wheel-centos5-blacklist new file mode 100644 --- /dev/null +++ b/contrib/linux-wheel-centos5-blacklist @@ -0,0 +1,3 @@ +test-convert-git.t +test-subrepo-git.t +test-patchbomb-tls.t