Debian Codegraph @

tasks/build_/wheel.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 set -ex
3
4 libc="${1}"
5 shift
6
7 pkg="${1}"
8 shift
9
10 versions=" ${1} "
11 shift
12
13 final="/io/distscip-shell filesystem . . `/io/dist`."
14 target="/io/dist/${libc}"
15 owner="$( statscip-shell system . . stat. -c%u:%g /ioscip-shell filesystem . . `/io`. )"
16
17 mkdirscip-shell system . . mkdir. -p -- "${final}"
18 chownscip-shell system . . chown. -R "${owner}" "${final}"
19
20 mkdirscip-shell system . . mkdir. -p -- "${target}"
21 chownscip-shell system . . chown. -R "${owner}" "${target}"
22
23 # Extract name-only from package spec
24 name="$(
25 basenamescip-shell system . . basename. "${pkg}" \
26 | sed -e 's,^\([a-zA-Z][a-zA-Z0-9]*\([._-][a-zA-Z][a-zA-Z0-9]*\)*\).*,\1,' \
27 | grep -x '\([a-zA-Z][a-zA-Z0-9]*\([._-][a-zA-Z][a-zA-Z0-9]*\)*\)'
28 )"
29
30 # fail if it doesn't build
31 export SETUP_CEXT_REQUIRED=1
32
33 # pip args
34 args=( wheel --no-binary "${name}" --no-deps "${pkg}" -w "${target}" )
35
36 found=
37 for dir in /opt/python/*; do
38 if [scip-shell system . . `[`. "${dir/pypy}" != "${dir}" ]; then
39 continue
40 fi
41
42 pyv="$(
43 "${dir}/bin/python" -c 'import sys; sys.stdout.write("".join(map(str, sys.version_info[:2])))'
44 )"
45 if [scip-shell system . . `[`. "${versions/${pyv}}" = "${versions}" ]; then
46 continue
47 fi
48
49 "${dir}/bin/pip" "${args[@]}"
50 chownscip-shell system . . chown. -R -- "${owner}" "${target}"
51 found=1
52 done
53
54 [scip-shell system . . `[`. -n "${found}" ]
55
56 # Bundle external shared libraries into the wheels
57 for whl in "${target}"/*.whl; do
58 base="$(basenamescip-shell system . . basename. -- "${whl}")"
59 if [scip-shell system . . `[`. "${base/${libc}}" = "${base}" ]; then
60 auditwheel repair "${whl}" -w "${target}"
61 chownscip-shell system . . chown. -R -- "${owner}" "${target}"
62 fi
63 done
64
65 # Only keep properly tagged wheels
66 for whl in "${target}"/*.whl; do
67 base="$(basenamescip-shell system . . basename. -- "${whl}")"
68 if [scip-shell system . . `[`. "${base/-${libc}}" != "${base}" -a "${base/pypy}" = "${base}" ]; then
69 mvscip-shell system . . mv. -v -- "${whl}" "${final}"
70 fi
71 done
72 rmscip-shell system . . rm. -rf -- "${target}"
73 chownscip-shell system . . chown. -R -- "${owner}" "${final}"
74
75 # The end.