#!/bin/bash

# CONTEXT: GUEST during CONSTRUCTION as ROOT
# PURPOSE: Install trove guest python dependencies - see trovestack functions_qemu

set -e
set -o xtrace

export DEBIAN_FRONTEND=noninteractive
apt-get -y install python-dev libxml2-dev libxslt1-dev python-setuptools \
    python-pip python-sqlalchemy python-lxml \
    python-routes python-eventlet python-webob \
    python-pastedeploy python-paste python-netaddr \
    python-httplib2 python-iso8601 python-pexpect python-mysqldb python-migrate


# pick up the requirements file left for us by
# extra-data.d/15-reddwarf-dep

TMP_HOOKS_DIR="/tmp/in_target.d"

UPPER_CONSTRAINTS=
if [ -f ${TMP_HOOKS_DIR}/upper-constraints.txt ]; then
    UPPER_CONSTRAINTS=" -c ${TMP_HOOKS_DIR}/upper-constraints.txt"
fi

pip install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS}

echo "diagnostic pip freeze output follows"
pip freeze
echo "diagnostic pip freeze output above"
