#!/bin/bash

set -eo pipefail

# Generic wrapper script that will enable a virutalenv and execute the python
# module matching the scripts name.

NAME=$(basename $0)
MODULE_PATH=$(dirname $(realpath $0))

if [ -z ${VIRTUAL_ENV+x} ]; then
   source "$HOME/.pyenv/versions/$NAME/bin/activate"
fi

# Load module from project directory
PYTHONPATH="$MODULE_PATH/.." exec python3 -m $NAME "$@"
