#!/bin/bash

SOURCE_PATH="${BASH_SOURCE[0]:-${(%):-%x}}"

RELATIVE_PATH="$(dirname "$SOURCE_PATH")"
ABSOLUTE_PATH="$(realpath "${RELATIVE_PATH}")"
source "${ABSOLUTE_PATH}"/config.sh

echo the name is "$ENV_NAME"

echo "Setting up the python interpreter script in the following dir: " "~/.local/share/python/interpreter/${ENV_NAME}"

mkdir -p ~/.local/share/python/interpreter/"${ENV_NAME}"

echo '
#!/bin/bash
source "'"${ABSOLUTE_PATH}"'"/activate.sh  2> /dev/null > /dev/null
python "$@"
' > ~/.local/share/python/interpreter/"${ENV_NAME}"/python

chmod a+x ~/.local/share/python/interpreter/"${ENV_NAME}"/python
