-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathci-repair-wheel.sh
More file actions
executable file
·52 lines (46 loc) · 1.73 KB
/
ci-repair-wheel.sh
File metadata and controls
executable file
·52 lines (46 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/bash
set -xe
PYTHON=${PYTHON:-python3.9}
if [ $(uname) == "Darwin" ]; then
$PYTHON -m pip install delocate
# move the mis-named scipy_openblas64-none-any.whl to a platform-specific name
# if [ "${PLAT}" == "arm64" ]; then
# for f in $2/*.whl; do mv $f "${f/%any.whl/macosx_11_0_$PLAT.whl}"; done
# else
# for f in $2/*.whl; do mv $f "${f/%any.whl/macosx_10_9_$PLAT.whl}"; done
# fi
delocate-wheel -w $1 -v $2
cp libs/openblas*.tar.gz dist/
else
auditwheel repair -w $1 --lib-sdir /lib $2
# rm dist/scipy_openblas*-none-any.whl
# rm {dest_dir}/*.whl
# Add an RPATH to libgfortran:
# https://github.com/pypa/auditwheel/issues/451
# Use zipfile since the manylinux images do not have `zip`
python3 -c "
import re, sys, zipfile, pathlib
whl = next(pathlib.Path(sys.argv[1]).glob('*.whl'))
with zipfile.ZipFile(whl, 'a') as z:
members = [m for m in z.namelist() if re.search(r'libgfortran', m)]
z.extractall(members=members)
" "$1"
patchelf --force-rpath --set-rpath '$ORIGIN' */lib/libgfortran*
python3 -c "
import sys, zipfile, pathlib, glob
whl = next(pathlib.Path(sys.argv[1]).glob('*.whl'))
patched = {f: pathlib.Path(f).read_bytes() for f in glob.glob('*/lib/libgfortran*')}
# Read all original entries, replacing patched one
entries = {}
with zipfile.ZipFile(whl, 'r') as z:
for item in z.infolist():
entries[item] = patched.get(item.filename, z.read(item.filename))
# Rewrite the archive
with zipfile.ZipFile(whl, 'w', compression=zipfile.ZIP_DEFLATED) as z:
for item, data in entries.items():
z.writestr(item, data)
" "$1"
mkdir -p /output
# copy libs/openblas*.tar.gz to dist/
cp libs/openblas*.tar.gz /output/
fi