Commit 484eefb1 authored by Andrew Murray's avatar Andrew Murray
Browse files

Do not modify original wheel if name is not changed

parent f46e683b
......@@ -10,18 +10,29 @@ function get_platform {
}
function repair_wheelhouse {
# Runs 'auditwheel repair' over all wheels in a directory
# If the wheel is not renamed by the repair process,
# then the original wheel will be left unmodified
local in_dir=$1
local out_dir=${2:-$in_dir}
for whl in $in_dir/*.whl; do
if [[ $whl == *none-any.whl ]]; then # Pure Python wheel
if [ "$in_dir" != "$out_dir" ]; then cp $whl $out_dir; fi
else
wheel_count=$(find $out_dir -name *.whl | wc -l)
auditwheel repair $whl -w $out_dir/
if [[ $(find $out_dir -name *.whl | wc -l) -gt $wheel_count ]]; then
local tmpdir=$(mktemp -d -t)
auditwheel repair $whl -w $tmpdir/
local built=$(find $tmpdir -name *.whl)
if [ $(basename $built) == $(basename $whl) ]; then
if [ "$in_dir" != "$out_dir" ]; then cp $whl $out_dir; fi
else
cp $built $out_dir
# Remove unfixed if writing into same directory
if [ "$in_dir" == "$out_dir" ]; then rm $whl; fi
fi
rm -rf $tmpdir
fi
done
chmod -R a+rwX $out_dir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment