contrib/packaging/build-linux-wheels.sh
author Raphaël Gomès <rgomes@octobus.net>
Mon, 28 Feb 2022 18:34:23 +0100
branchstable
changeset 48805 d4486810a179
parent 38011 6f5b4ceea95b
permissions -rwxr-xr-x
merge: remove direct rustmod reference We shouldn't rely on this member being present in `dirstate.py`, this creates unnecessary coupling. This also can trigger certain issues in edge-cases where the policy is changed at runtime or multiple Python environments fight, which is an added bonus. Differential Revision: https://phab.mercurial-scm.org/D12217

#!/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/cp27*/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/packaging/linux-wheel-centos5-blacklist"
done