-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_venv.sh
executable file
·71 lines (59 loc) · 1.43 KB
/
run_venv.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
#Quit if any error!
set -e
myhdl_env_name="myhdl_env"
function usage {
echo "usage: $1 [-crh] "
echo " -c Create python3 virtual environment for myhdl"
echo " -r Remove virtual environment for myhdl"
echo " -h display help"
exit 1
}
function activate_env {
source $myhdl_env_name/bin/activate
}
function deactivate_env {
deactivate
}
function create_env {
echo "Creating python 3 virtual environment"
python3 -m venv $myhdl_env_name
echo "Activating new environment"
activate_env
pip install wheel
echo "Installing myhdl"
pip install myhdl
echo "Installing myhdl_lib"
pip install myhdl_lib
echo "Installing scipy"
pip install scipy
echo "Installing python-opencv"
pip install yapf
echo "Installing yapf"
pip install opencv-python
echo "All requirements installed!"
echo "Deactivating environment! "
deactivate_env
echo "To activate the newly created environemt run: source $myhdl_env_name/bin/activate "
}
function remove_env {
echo "Removing myhdl virtual environment"
rm -rf $myhdl_env_name
}
#Using bash builtin getopts option
while getopts ":cadrh" opt; do
case $opt in
c) create_env $0
;;
r) remove_env $0
;;
h) usage $0
;;
*) echo "Invalid option: -$OPTARG" >&2
usage $0
;;
#\?)
# echo "Invalid option: -$OPTARG" >&2
# ;;
esac
done