28 lines
786 B
Bash
Executable File
28 lines
786 B
Bash
Executable File
#!/bin/bash
|
|
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
|
|
# Script is being sourced
|
|
export BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
else
|
|
# Script is being executed
|
|
export BASE_DIR="$( cd "$( dirname "${0}" )" && pwd )"
|
|
fi
|
|
export VENV_DIR="${BASE_DIR}/.venv"
|
|
|
|
python3 -m venv "$VENV_DIR"
|
|
source $VENV_DIR/bin/activate
|
|
|
|
# Check if the directory exists
|
|
if [ ! -d "$VENV_DIR" ]; then
|
|
echo "Directory $VENV_DIR does not exist. Creating it and setting up a virtual environment."
|
|
# The -p flag makes mkdir create any necessary parent directories as well
|
|
mkdir -p "$VENV_DIR"
|
|
# Create the virtual environment
|
|
python3 -m venv "$VENV_DIR"
|
|
python3 -m pip install --upgrade pip
|
|
fi
|
|
|
|
export CONTEXTROOT='~/context'
|
|
|
|
|
|
echo "We're good to go"
|