-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·82 lines (67 loc) · 1.28 KB
/
setup.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
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash
SLIM_SETUP=false
VENV_ROOT="./venv"
usage() {
echo "\
Usage: source ./setup [OPTIONS]
Use to setup local development environment.
Options:
--slim skip some steps in order to speed up the setup, useful if recently setup
" 1>&2
}
if [[ $# -gt 0 ]]; then
case $1 in
--slim)
SLIM_SETUP=true
;;
--help)
usage
return
;;
*)
usage
return
;;
esac
fi
is_windows() {
case "$(uname -sr)" in
CYGWIN*|MINGW*|MINGW32*|MSYS*)
return 0
;;
*)
return 1
;;
esac
}
activate_venv() {
if is_windows; then
source "${VENV_ROOT}/Scripts/activate"
else
source "${VENV_ROOT}/bin/activate"
fi
}
setup_submodules() {
git submodule update --init --recursive
}
setup_python() {
python3 -m venv "${VENV_ROOT}"
activate_venv
python3 -m pip install --upgrade pip
python3 -m pip install -e ./tools
}
setup_python_slim() {
activate_venv
}
setup_env_vars() {
export DOCKER_BUILDKIT=1
}
if [[ "${SLIM_SETUP}" == "true" ]]; then
echo "Skipping some steps in order to speed up the setup"
setup_python_slim
setup_env_vars
else
setup_submodules
setup_python
setup_env_vars
fi