#!/bin/bash
scriptname=`basename $0`
if [ ! -d "/build/toolchain" ]; then
    cat <<EOF 1>&2
$scriptname: error: /build/toolchain does not contain the expected binaries.
$scriptname: error: Please see https://wiki.eng.vmware.com/Build/Toolchain/Access
$scriptname: error: for information on how to set up toolchain.
EOF
   exit 2
fi

if [ `uname -m` = "x86_64" ]; then
   ARCH="64"
else
   ARCH="32"
fi

case `uname -s` in
   Linux) python_root=/build/toolchain/lin$ARCH/python-2.7.8;;
   Darwin) python_root=/build/toolchain/mac32/python-2.7.1;;
   *) echo "$scriptname: unsupported platform: `uname -s`" 1>&2; exit 2;;
esac
python=$python_root/bin/python
p4python="/build/toolchain/lin$ARCH/p4python-r15.1/lib/python2.7/site-packages"

export PYTHONPATH=$PYTHONPATH:/build/toolchain/noarch/six-1.9.0/lib/python2.7/site-packages:${p4python}

exec "$python" -Wignore::DeprecationWarning "$0".py "$@"
exit $?
