-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathproteus.sh
71 lines (56 loc) · 2.12 KB
/
proteus.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
echo "PROTEUS: v1.2.0-beta"
# Initialize variables
python_executable=
# Check if either 'python' or 'python3' is installed
if command -v python3.11 > /dev/null 2>&1; then
python_executable=python3.11
elif command -v python > /dev/null 2>&1; then
python_executable=python
elif command -v python3 > /dev/null 2>&1; then
python_executable=python3
fi
if [ -n "$python_executable" ]; then
echo "PROTEUS: $python_executable is installed on your system."
echo "PROTEUS: Installed Python version:"
$python_executable --version || true
else
echo "PROTEUS: Neither 'python', 'python3', nor 'python3.11' was found on your system."
echo "PROTEUS: Please install Python and try running this script again. Recommended version: 3.11.x"
exit 1
fi
script_dir="$(dirname "$0")"
venv_dir="$script_dir/proteus_env"
echo "PROTEUS: Checking for the existence of virtual environment 'proteus_env'"
if [ -d "$venv_dir" ]; then
echo "PROTEUS: Environment 'proteus_env' was found."
else
echo "PROTEUS: Environment 'proteus_env' was not found."
echo "PROTEUS: Creating a virtual environment using $python_executable..."
$python_executable -m venv "$venv_dir"
if [ -d "$venv_dir" ]; then
echo "PROTEUS: Virtual environment created successfully."
else
echo "PROTEUS: Failed to create the virtual environment."
# If failed to create the venv, show the error message and exit
exit 1
fi
fi
echo "PROTEUS: Activating the virtual environment..."
source "$venv_dir/bin/activate"
# Check if the virtual environment is activated
if [ $? -ne 0 ]; then
echo "PROTEUS: Failed to activate the virtual environment. Check if python venv package is installed."
# Delete proteus_env if it exists
if [ -d "$venv_dir" ]; then
rm -rf "$venv_dir"
fi
exit 1
fi
echo "PROTEUS: Virtual environment Python version:"
python --version || true
echo "PROTEUS: Installing the required packages..."
pip install -r "$script_dir/requirements.txt"
# Run the application in the background so the console can be closed
echo "PROTEUS: Running the application..."
python -m proteus &