#!/usr/bin/env bash
# Wed 21 Sep 2016 13:08:05 CEST

source $(dirname ${0})/functions.sh

check_env DOCSERVER
check_env CONDA_PREFIX
check_env CI_PROJECT_NAME

BOB_DOCUMENTATION_SERVER="${DOCSERVER}/software/bob/docs/latest/bob/%s/master/"
PREFIX=`pwd`/${CONDA_PREFIX}

run_cmd $(dirname ${0})/before_build.sh

# Verify where pip is installed
use_pip=`which pip`
if [ -z "${use_pip}" ]; then
  log_error "Cannot find pip, aborting..."
  exit 1
else
  log_info "Using pip: ${use_pip}"
fi

# zc.recipe.egg needs some special installation instructions
if [ "${CI_PROJECT_NAME}" == "bob.buildout" ]; then
  run_cmd ${use_pip} install --no-binary ":all:" zc.recipe.egg
fi

run_cmd ${PREFIX}/bin/pip install --use-wheel --no-index --pre dist/*.whl
