From 4f35c93fdebe4b06cfa4a50e79d510ae1729a704 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 4 Dec 2018 13:56:13 -0500 Subject: Initial commit --- etc/tasks/003-python-packages.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 etc/tasks/003-python-packages.sh (limited to 'etc/tasks/003-python-packages.sh') diff --git a/etc/tasks/003-python-packages.sh b/etc/tasks/003-python-packages.sh new file mode 100755 index 0000000..cb248ff --- /dev/null +++ b/etc/tasks/003-python-packages.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -x + +# Uses GLOBAL environment variable: PYTHON_VERSION defined by `docker build` argument +prefix="${TOOLCHAIN}" +sysconfdir="${TOOLCHAIN_BUILD}/etc" +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 -v -r "${req}" + done + post +} + +function post() +{ + rm -rf ~/.cache/pip + [[ -d src ]] && rm -rf src + [[ -f gmon.out ]] && rm -rf gmon.out +} + +build -- cgit