#!/usr/bin/env bash
# Sat 28 Jan 09:16:48 2017 CET

if [ "${#}" != 1 ]; then
  echo "usage: `basename $0` <prefix>"
  echo "example: `basename $0` /opt/conda"
  exit 1
fi

BASEDIR=$1
BINDIR=$(dirname $0)
CONDA=${BASEDIR}/bin/conda

echo "[>>] Cleaning conda cache..."
${CONDA} clean --all --yes

echo "[>>] Updating conda and conda-build..."
${CONDA} install -n root conda conda-build --yes

for k in 2.7 3.4 3.5; do
  py=`echo $k | sed -e 's/\.//'`
  e="bob-devel-py$py"
  echo "[>>] Installing CI environment $e using python-$k..."
  ${BINDIR}/from-scratch.sh ${BASEDIR} $e $k
done
