#!/bin/sh
#Install the required modules with pip if the script
#is executable to allow setup.py to run without errors.
#Usage: bootstrap python2.7 FOO=BAR

if [ "$(id -u)" != "0" ]; then
    echo "You must be root to run this program."
    exit 2
fi
if [ "$1" != "" ]; then
    python_exec="$1"
else
    echo "Usage: $- /path/to/python"
    exit 2
fi

#if [ -x "ez_setup.py" ]; then 
# #Install latest setuptools
# echo "Launching ez_setup.py script for $python_exec"
# eval "$python_exec ./ez_setup.py" || true
#fi

install_package(){
    #shift;

    with_pip=1
    if [ -n "$with_pip" ]; then
     command_script=pip
     package_name="$1";
     eval "$command_script install '$package_name'" || true;
    fi;
}

install_package "pyyaml"
install_package "Cython>=0.27.1"


echo "Now run 'sudo make develop PYTHON=$python_exec' if you intend developing in place."
exit 0
