Skip to content

Commit 6c399ae

Browse files
committed
avoid 'yum install' by using python
1 parent 0bfdd11 commit 6c399ae

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

ci-repair-wheel.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@ else
2121

2222
# Add an RPATH to libgfortran:
2323
# https://github.com/pypa/auditwheel/issues/451
24-
if [ "$MB_ML_LIBC" == "musllinux" ]; then
25-
apk add zip
26-
else
27-
yum install -y zip
28-
fi
29-
unzip $1/*.whl "*libgfortran*"
24+
# Use zipfile since the manylinux images do not have `zip`
25+
python3 -c "
26+
import re, sys, zipfile, pathlib
27+
whl = next(pathlib.Path(sys.argv[1]).glob('*.whl'))
28+
with zipfile.ZipFile(whl, 'a') as z:
29+
members = [m for m in z.namelist() if re.search(r'libgfortran', m)]
30+
z.extractall(members=members)
31+
" "$1"
3032
patchelf --force-rpath --set-rpath '$ORIGIN' */lib/libgfortran*
31-
zip $1/*.whl */lib/libgfortran*
33+
python3 -c "
34+
import sys, zipfile, pathlib, glob
35+
whl = next(pathlib.Path(sys.argv[1]).glob('*.whl'))
36+
with zipfile.ZipFile(whl, 'a') as z:
37+
for f in glob.glob('*/lib/libgfortran*'):
38+
z.write(f)
39+
" "$1"
3240
mkdir -p /output
3341
# copy libs/openblas*.tar.gz to dist/
3442
cp libs/openblas*.tar.gz /output/

0 commit comments

Comments
 (0)