-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.bash
executable file
·79 lines (70 loc) · 1.82 KB
/
setup.bash
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
72
73
74
75
76
77
78
79
#!/bin/bash
# Run this script from repository root
if [[ ! $PWD = *cos-pomdp ]]; then
echo "You must be in the root directory of the cos-pomdp repository."
return 1
fi
repo_root=$PWD
if [ ! -d "venv/cosp" ]; then
virtualenv -p python3 venv/cosp
source venv/cosp/bin/activate
pip install -e . # install the cos-pomdp package
fi
source_venv=true
if [[ "$VIRTUAL_ENV" == *"cosp"* ]]; then
source_venv=false
fi
if [ $source_venv = true ]; then
source venv/cosp/bin/activate
fi
# Parse arguments
setup_repos=false
update_submodules=false
for arg in "$@"
do
if [[ "$arg" == -* ]]; then
if [ "$arg" == "-I" ]; then
setup_repos=true
elif [ "$arg" == "-s" ]; then
update_submodules=true
fi
fi
done
# Submodules
cd $repo_root
if [ $update_submodules = true ]; then
git submodule update --force --recursive --init --remote
fi
# create symbolic link to mjolnir directory
if [ ! -e "cospomdp_apps/thor/mjolnir" ]; then
ln -sf $(readlink -f external/mjolnir) cospomdp_apps/thor/mjolnir
fi
# clone and install necessary repositories, if not yet already
if [ $setup_repos = true ]; then
pip install numpy
pip install matplotlib
pip install torchvision
pip install networkx
pip install pytest
pip install gdown
cd external
# clone thortils
if [ ! -d "thortils" ]; then
git clone [email protected]:zkytony/thortils.git
cd thortils
git checkout v3.3.4-stable
git pull
pip install -e .
cd ..
fi
fi
cd $repo_root
# ask if want to create alias command
if [[ $source_venv = false ]]; then
read -p "Create alias 'cosp' for starting cos-pomdp venv? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]];
then
echo -e "alias cosp='cd $repo_root; source setup.bash'" >> ~/.bashrc
fi
fi