File: build.sh

package info (click to toggle)
python-rjsmin 1.1.0%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,952 kB
  • sloc: python: 2,515; ansic: 735; sh: 62; makefile: 19
file content (53 lines) | stat: -rwxr-xr-x 1,158 bytes parent folder | download
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
53
#!/bin/bash
set -ex

pkg="${1}"
shift

versions=" ${1} "
shift

target="/io/dist"
owner="$( stat -c%u:%g /io )"

mkdir -p -- "${target}"
chown -R "${owner}" "${target}"

name="$(
    basename "${pkg}" \
    | sed -e 's,^\([a-zA-Z][a-zA-Z0-9]*\([._-][a-zA-Z][a-zA-Z0-9]*\)*\).*,\1,' \
    | grep -x '\([a-zA-Z][a-zA-Z0-9]*\([._-][a-zA-Z][a-zA-Z0-9]*\)*\)'
)"

args=( wheel --no-binary "${name}" --no-deps "${pkg}" -w "${target}" )

found=
for dir in /opt/python/*; do
    pyv="$(
        "${dir}/bin/python" -c 'import sys; sys.stdout.write("".join(map(str, sys.version_info[:2])))'
    )"
    if [ "${versions/${pyv}}" = "${versions}" ]; then
        continue
    fi

    "${dir}/bin/pip" "${args[@]}"
    chown -R "${owner}" "${target}"
    found=1
done

[ -n "${found}" ]

# Bundle external shared libraries into the wheels
for whl in "${target}"/*.whl; do
    if [ "${whl/manylinux}" = "${whl}" ]; then
        auditwheel repair "${whl}" -w "${target}"
        chown -R "${owner}" "${target}"
    fi
done

# Only keep manylinux wheels
for whl in "${target}"/*.whl; do
    if [ "${whl/-manylinux}" = "${whl}" ]; then
        rm -vf -- "${whl}"
    fi
done