#!/usr/bin/bash

_realpath=$(realpath ${0})
_dirname=$(dirname ${_realpath})
_basename=$(basename ${0})
if [[ ! ":$PATH:" =~ ":${_dirname}:" ]]; then
   PATH=${_dirname}${PATH:+:}$PATH; export PATH
fi
if [[ -e ${_dirname}/${_basename}.py ]]; then
    # We don't use pbench-base.py to invoke python programs, they can use the
    # PbenchServerConfig class directly.
    ${_dirname}/${_basename}.py ${@}
else
    export PROG=${_basename}
    export dir=${_dirname}
    ${_dirname}/pbench-base.py ${0} ${@}
fi
