34 lines
746 B
Bash
Executable File
34 lines
746 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# --- Check if venv exists, create if not ---
|
|
|
|
[ ! -d "./venv/" ] && {
|
|
echo -n " - venv not detected, creating... "
|
|
/usr/bin/env python3 -m venv venv || {
|
|
echo "Failed to initialize virtual environment. Quitting."
|
|
exit 1
|
|
}
|
|
|
|
echo "OK"
|
|
echo ""
|
|
}
|
|
|
|
pycmd='./venv/bin/python3'
|
|
|
|
# --- Make sure the current requirements are met ---
|
|
|
|
$pycmd -c "import pkg_resources; pkg_resources.require(open('requirements.txt',mode='r'))" &>/dev/null || {
|
|
echo " - Requirements not installed, installing..."
|
|
|
|
$pycmd -m pip install -r 'requirements.txt' || {
|
|
echo "Errored out while trying to install requirements. Check logs above."
|
|
}
|
|
|
|
echo ""
|
|
}
|
|
|
|
|
|
# --- Run the code ---
|
|
|
|
$pycmd src/main.py "$@"
|