summaryrefslogtreecommitdiff
path: root/etc/hstdp-2019.5/tasks/002-python-packages.sh
blob: 33714aa10cebd4eb0f299d6b1a4daf9cb4a24e16 (plain) (blame)
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
#!/bin/bash
set -e
set -x

# Uses GLOBAL environment variable: PYTHON_VERSION defined by `docker build` argument
prefix="${TOOLCHAIN}"
sysconfdir="${TOOLCHAIN_BUILD}/etc/${PIPELINE}"
reqdir=${sysconfdir}/pip

export PATH="${prefix}/bin:${PATH}"
export CFLAGS="-I${prefix}/include"
export LDFLAGS="-L${prefix}/lib -Wl,-rpath=${prefix}/lib"

function pre()
{
    if [[ ! -d ${reqdir} ]]; then
        # Nothing there, but maybe that's on purpose.
        exit 0
    fi
}

function build()
{
    pre
    # Iterate over pip requirement files
    for req in ${reqdir}/*
    do
        pip install --upgrade --progress-bar=off -r "${req}"
    done
    post
}

function post()
{
    rm -rf ~/.cache/pip
    [[ -d src ]] && rm -rf src || true
    [[ -f gmon.out ]] && rm -rf gmon.out || true
}

build