#!/usr/bin/env bash
# Need to use bash because otherwise . sends in args to activate scripts,
# which does not work
# Depends on individual arguments in env variables not being quoted; any space
# within a single argument must be escaped (e.g. \ )

IFS=' '
if [ -n "$WING_PREACTIVATE_COMMAND" ]; then
  read -a arr <<< "${WING_PREACTIVATE_COMMAND}"
  unset WING_PREACTIVATE_COMMAND
  . "${arr[@]}"
fi 

if [ -n "$WING_ACTIVATE_COMMAND" ]; then
  read -a arr <<< "${WING_ACTIVATE_COMMAND}"
  unset WING_ACTIVATE_COMMAND
  . "${arr[@]}"
fi
 
read -a arr <<< "${WING_ACTIVATE_PYTHON}"
"${arr[@]}" "$@"
