Adapting Linux bash script for multiple output wheels from auditwheel

This commit is contained in:
Yannick Jadoul
2019-10-16 00:34:13 +02:00
parent 27517cd8a0
commit 4571262803
+8 -8
View File
@@ -64,9 +64,9 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
for PYBIN in {pybin_paths}; do for PYBIN in {pybin_paths}; do
# Setup # Setup
rm -rf /tmp/built_wheel rm -rf /tmp/built_wheel
rm -rf /tmp/delocated_wheel rm -rf /tmp/delocated_wheels
mkdir /tmp/built_wheel mkdir /tmp/built_wheel
mkdir /tmp/delocated_wheel mkdir /tmp/delocated_wheels
if [ ! -z {before_build} ]; then if [ ! -z {before_build} ]; then
PATH="$PYBIN:$PATH" sh -c {before_build} PATH="$PYBIN:$PATH" sh -c {before_build}
@@ -81,11 +81,11 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
# the first element # the first element
if [[ "$built_wheel" == *none-any.whl ]]; then if [[ "$built_wheel" == *none-any.whl ]]; then
# pure python wheel - just copy # pure python wheel - just copy
mv "$built_wheel" /tmp/delocated_wheel mv "$built_wheel" /tmp/delocated_wheels
else else
auditwheel repair "$built_wheel" -w /tmp/delocated_wheel auditwheel repair "$built_wheel" -w /tmp/delocated_wheels
fi fi
delocated_wheel=(/tmp/delocated_wheel/*.whl) delocated_wheels=(/tmp/delocated_wheels/*.whl)
if [ ! -z {test_command} ]; then if [ ! -z {test_command} ]; then
# Set up a virtual environment to install and test from, to make sure # Set up a virtual environment to install and test from, to make sure
@@ -102,7 +102,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
echo "Running tests using `which python`" echo "Running tests using `which python`"
# Install the wheel we just built # Install the wheel we just built
pip install "$delocated_wheel"{test_extras} pip install "${{delocated_wheels[0]}}"{test_extras}
# Install any requirements to run the tests # Install any requirements to run the tests
if [ ! -z "{test_requires}" ]; then if [ ! -z "{test_requires}" ]; then
@@ -120,8 +120,8 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
fi fi
# we're all done here; move it to output # we're all done here; move it to output
mv "${{delocated_wheel[@]}}" /output mv "${{delocated_wheels[@]}}" /output
chown {uid}:{gid} "/output/$(basename "$delocated_wheel")" for delocated_wheel in "${{delocated_wheels[@]}}"; do chown {uid}:{gid} "/output/$(basename "$delocated_wheel")"; done
done done
'''.format( '''.format(
pybin_paths=' '.join(c.path+'/bin' for c in platform_configs), pybin_paths=' '.join(c.path+'/bin' for c in platform_configs),