-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
39 lines (32 loc) · 1.24 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Virtual environment directory name
VENV_DIR=".yolofid"
echo "Setting up the virtual environment for the project..."
# Create the virtual environment if it doesn't exist
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment in $VENV_DIR..."
python3 -m venv "$VENV_DIR"
else
echo "The virtual environment already exists."
fi
# Detect the operating system and activate the virtual environment
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
ACTIVATE_CMD="source $VENV_DIR/bin/activate"
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
ACTIVATE_CMD="source $VENV_DIR/Scripts/activate"
else
echo "Unsupported operating system for automatic virtual environment activation."
exit 1
fi
# Print the command for the user to run manually if not using 'source script.sh'
echo "Running: $ACTIVATE_CMD"
eval "$ACTIVATE_CMD"
# Install dependencies if requirements_simple.txt exists
if [ -f "requirements_simple.txt" ]; then
echo "Installing dependencies from requirements_simple.txt..."
pip install --upgrade pip
pip install -r requirements_simple.txt
else
echo "No requirements_simple.txt file found, run pyreqs if needed."
fi
echo "Environment setup and activated."