contrib/build-linux-wheels.sh
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 11 Feb 2018 20:59:35 -0500
changeset 36092 fe5c4b795999
parent 33579 637267114513
permissions -rwxr-xr-x
test-merge-tools: stabilize for Windows This masks the Windows argument parsing insanity[1], so it needs a bit of explanation. (The security reference in the footnote is probably useful to keep in mind if we ever whitelist certain in-repo config settings.) 9037c29e9f53 introduced tests that were failing on Windows with an unbalanced double quote[2]. What ends up happening here is util.shellquote() is double quoting the file path, but the shell script is placing this ->": "<- right next to it. So cmd.exe gets launched with 'lb:base": ""c:\...\f~base.xyz"', which got interpreted as 'lb:base: "c:\...\f~base.xyz'. If the test is adjusted to quote like "lb:$labelbase: $base", then MSYS runs interference and strips the '\' characters. I was able to get the expected result by dropping the quotes from '": "', and changing the space to underscore. But since we need to glob away the C: part anyway, just glob away the quote and leave the test unchanged. [1] https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ [2] https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/441/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio

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