-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_setup.sh
executable file
·43 lines (36 loc) · 1.41 KB
/
local_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
40
41
42
43
#!/bin/sh
echo "===================================================================="
echo "Welcome to to the setup. This will setup the local virtual env. "
echo "And then it will install all the required python libraries. "
echo "You can rerun this without any issues. "
echo "===================================================================="
# Check if .env folder exists
if [ -d ".env" ]; then
echo ".env folder exists. Installing using pip"
else
echo "creating .env and install using pip"
python -m venv .env
fi
# Activate virtual environment (corss-platform)
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
# Linux or macOS
source .env/bin/activate
elif [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Cygwin (POSIX compatibility layer for Windows) or MSYS (Git Bash)
.env/Scripts/activate.bat
else
echo "Unsupported operating system. Please activate the virtual environment manually and install the modules from the requirements.txt file."
exit 1
fi
# Upgrade the pip
pip install --upgrade pip
# Install required packages
pip install -r requirements.txt
# Deactivate the virtual environment
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
# Linux or macOS
deactivate
elif [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Cygwin (POSIX compatibility layer for Windows) or MSYS (Git Bash)
.env/Scripts/deactivate.bat
fi