#!/bin/sh

# Set the python environement
PYTHONHOME=$1
export PYTHONHOME
PATH=$PYTHONHOME/bin:$PATH
export PATH
LD_LIBRARY_PATH=$PYTHONHOME/lib
export LD_LIBRARY_PATH

# Get the goals for setup.py
GOALS=$2
if [ "${GOALS}" != "skip" ]
then
    # Launch the goals
    python setup.py ${GOALS}
    if [ $? -ne 0 ]
    then
        echo "ERROR: python setup.py ${GOALS} failed"
        exit 1
    fi
fi

# Get all the argument for nosetests except the first one
shift 2

# Call nosetests
nosetests $*
exit $?

