martinrusev
6/9/2015 - 7:21 AM

Update Amon Requirements

Update Amon Requirements

#! /usr/bin/env bash
set -xe
 
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PACKAGE=amon
export AMON_DIR='/opt/amon'
export AMON_PYTHON_PATH='/usr/share/python'

echo -e "\033[33m\e[1m\n* Updating deb repository \n\033[0m"
sudo apt-get update > /dev/null
 

echo -e "\033[33m\e[1m\n* Installing ${PACKAGE} dependencies \n\033[0m"
sudo apt-get install -qq -y --force-yes python-pip python-setuptools > /dev/null
sudo pip install --upgrade pip
sudo pip install virtualenv-tools virtualenv > /dev/null

echo -e "\033[33m\e[1m\n* Setting up the virtualenv \n\033[0m"
rm -rf ${AMON_PYTHON_PATH}/${PACKAGE}
mkdir -p ${AMON_PYTHON_PATH} > /dev/null
virtualenv ${AMON_PYTHON_PATH}/${PACKAGE} > /dev/null
 

echo -e "\033[33m\e[1m\n* Installing distribute \n\033[0m"
${AMON_PYTHON_PATH}/${PACKAGE}/bin/pip install -U pip distribute > /dev/null
${AMON_PYTHON_PATH}/${PACKAGE}/bin/pip uninstall -y distribute > /dev/null
 
echo -e "\033[33m\e[1m\n* Installing ${PACKAGE} requirements \n\033[0m"
${AMON_PYTHON_PATH}/${PACKAGE}/bin/pip install -r ${AMON_DIR}/requirements.txt > /dev/null
 

echo -e "\033[33m\e[1m\n* Cleaning ${PACKAGE} \n\033[0m"
cd ${AMON_PYTHON_PATH}/${PACKAGE}
virtualenv-tools --update-path ${AMON_PYTHON_PATH}/${PACKAGE} > /dev/null
cd -

cd ${DIR}
 
echo -e "\033[33m\e[1m\n* Removing compiled files\n\033[0m"
find -iname *.pyc -exec rm {} \;
find -iname *.pyo -exec rm {} \;