-
Notifications
You must be signed in to change notification settings - Fork 0
/
source_me.sh
44 lines (36 loc) · 971 Bytes
/
source_me.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
dest="git_gui_venv"
echo "Check python environment"
if [ ! -d "$(pwd)/${dest}" ]
then
if [[ -d "${dest}" ]]
then
echo "WARNING: ${dest} already exits! Delete this enviroment before running this script again, 'rm -rf ${dest}'."
return
fi
if [ ! -e "requirements.txt" ]
then
echo "ERROR: Missing requirements.txt"
return
fi
python3 -m venv ${dest}
if [ "$?" -ne 0 ]
then
echo "ERROR: Venv failed"
return
fi
source ${dest}/bin/activate
python -V
pip install -r requirements.txt
if [ "$?" -ne 0 ]
then
echo "ERROR: pip install failed"
return
fi
echo "Venv ${dest} created!"
echo -e "\n\nTo enter the new virtual enviroment enter: 'source ${dest}/bin/activate'\n\n"
echo -e "\n\nTo leave the new virtual enviroment just enter: 'deactivate'\n\n"
else
source ${dest}/bin/activate
python -V
fi
export PATH=$(pwd)/bin:$PATH