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

#with_moin=1

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;
    command_script=`which easy_install`
    package_name="$1";
    eval "$command_script '$package_name'" || true;
}

install_package "pyyaml"
install_package "Cython>=0.18"


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