Unverified Commit 712c61a0 authored by Matthew Brett's avatar Matthew Brett Committed by GitHub
Browse files

Merge pull request #347 from radarhere/repair_wheelhouse_rm

MRG: Only remove original wheel if new wheel is created

We were getting errors when pip downloads a binary wheel, we attempt repair giving a wheel with the same filename, and then delete the original (and therefore, new) wheel on the basis that we have created a new one.

Back off to logic that, if repair generates a wheel with the same filename, we copy the original and discard the repaired version.
parents c2890dc8 484eefb1
...@@ -10,15 +10,29 @@ function get_platform { ...@@ -10,15 +10,29 @@ function get_platform {
} }
function repair_wheelhouse { 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 in_dir=$1
local out_dir=${2:-$in_dir} local out_dir=${2:-$in_dir}
for whl in $in_dir/*.whl; do for whl in $in_dir/*.whl; do
if [[ $whl == *none-any.whl ]]; then # Pure Python wheel if [[ $whl == *none-any.whl ]]; then # Pure Python wheel
if [ "$in_dir" != "$out_dir" ]; then cp $whl $out_dir; fi if [ "$in_dir" != "$out_dir" ]; then cp $whl $out_dir; fi
else else
auditwheel repair $whl -w $out_dir/ local tmpdir=$(mktemp -d -t)
# Remove unfixed if writing into same directory
if [ "$in_dir" == "$out_dir" ]; then rm $whl; fi 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 fi
done done
chmod -R a+rwX $out_dir 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