forked from zackees/template-docker-fastapi-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivate.sh
executable file
·48 lines (39 loc) · 984 Bytes
/
activate.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
#!/bin/bash
set -e
# Get the directory of the current script
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Change to that directory
cd "$script_dir"
# Confirm the current directory
echo "Changed directory to: $(pwd)"
echo "activate.sh change working directory to $(pwd)"
if [ "$IN_ACTIVATED_ENV" = "1" ]; then
IN_ACTIVATED_ENV=1
else
IN_ACTIVATED_ENV=0
fi
# If the 'venv' directory doesn't exist, print a message and exit.
if [ ! -d "venv" ]; then
cwd=$(pwd)
echo "The 'venv' directory in $cwd does not exist, creating..."
echo "OSTYPE: $OSTYPE"
case "$OSTYPE" in
darwin*|linux-gnu*)
python3 ./install.py
;;
*)
python ./install.py
;;
esac
. ./venv/bin/activate
export IN_ACTIVATED_ENV=1
this_dir=$(pwd)
export PATH="$this_dir:$PATH"
echo "Environment created."
pip install -e .
exit 0
fi
if [ "$IN_ACTIVATED_ENV" != "1" ]; then
. ./venv/bin/activate
export IN_ACTIVATED_ENV=1
fi