Test.env

From Noah.org
Jump to: navigation, search


#!/bin/sh
# This setups up environment variables for testing.
# This was originally created for setting up a private
# PYTHONPATH before switching to virtualenv, but
# this script could be handy for other applications.
# You may either source this or run this as a script.
# It is smart enough to work either way.

SOURCE_ARG=$_
# echo $$ $0 $SOURCE_ARG
ABS_PATH_HERE=`echo -n \`pwd\` ;( [ \`dirname \$SOURCE_ARG\` == '.' ] && echo ) || echo "/\`dirname \$SOURCE_ARG\`"`

case $0 in
    -*|sh*|bash*|ksh*)
        SOURCED=1
    ;;
    *)
        unset SOURCED
    ;;
esac

export PYTHONPATH=${ABS_PATH_HERE}
export PATH=$PATH:${ABS_PATH_HERE}/scripts

if [ $SOURCED ]; then
    return
else
    exec env $SHELL
fi