mirrored from https://gitlab.com/project-march/march
-
Notifications
You must be signed in to change notification settings - Fork 4
/
create_venv.sh
66 lines (58 loc) · 2.13 KB
/
create_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
#!/bin/sh
# This script is designed to automatically create a python virtual environment with all necessary dependencies.
# Note: This file virtual environment is not meant to run the ros code in, but for your IDE to easily index dependencies.\
# To run the march code with this venv you need to add the options --system-site-packages --symlinks to building,
# however this is not advised and you should use the docker images if you want to set the dependencies to
# a specific version.
# To run this code call `bash create_venv.sh` in a terminal console.
# date: 10-2021
# author: George Vegelien
# Exit on the first error
set -e
CACHE=true
while (("$#")); do
case "$1" in
# The default output if someone calls help on the bash script.
-h | --help)
echo "This bash script will make a virtual environment in the current folder."
echo "This will be a folder called '.venv_march'."
echo "To use this virtual environment call 'source .venv_march/bin/activate'"
printf "\n -n | --new \t\t\tThis will delete the current environment."
printf "\n -c | --clean | --no-cache \tThis will make sure that it freshly downloads all dependencies."
echo ""
exit 0;
;;
# The new parameter to delete the previous venv. (default=false).
-n | --new=) # unsupported flags
echo "The current virtual environment will be deleted."
rm -rf .venv_march/
shift
;;
# Installs all packages with the no-cache param to ensure a clean install. (default=false)
-c | --no-cache | --clean)
CACHE=false
shift
;;
-* | --*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
exit 1
;;
*) # preserve positional arguments
echo "Error: Unsupported arguments $1" >&2
exit 1
;;
esac
done
cd ~/march/
python3 -m venv .venv_march --system-site-packages --symlinks
touch .venv_march/COLCON_IGNORE
source ~/march/.venv_march/bin/activate
if [ $CACHE = true ]; then
pip install wheel==0.37.0
pip install -r requirements.txt
pip install -r requirements_colcon.txt
else
pip install --no-cache wheel==0.37.0
pip install --no-cache -r requirements.txt
pip install --no-cache -r requirements_colcon.txt
fi