forked from steveny91/ddev_vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ddev_1_step.sh
101 lines (78 loc) · 3.23 KB
/
ddev_1_step.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
GREEN="\033[1;32m"
NOCOLOR="\033[0m"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
## Install common dependencies
echo -e "${GREEN}Installing common dependencies${NOCOLOR}"
sudo apt update &&\
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl python-all-dev git \
unixodbc unixodbc-dev tdsodbc
## Linux
echo -e "${GREEN}Installing Pyenv${NOCOLOR}"
curl https://pyenv.run | bash
#pyenv
#pyenv update
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
echo -e "${GREEN}Exporting Pyenv variables to bashrc${NOCOLOR}"
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init --path)"' >> ~/.profile
echo 'export PATH="~/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
echo -e "${GREEN}Sourcing bashrc${NOCOLOR}"
source ~/.profile
source ~/.bashrc
echo -e "${GREEN}Updating pyenv metadata${NOCOLOR}"
pyenv update && echo "Done"
elif [[ "$OSTYPE" == "darwin"* ]]; then
## Mac
## Install Hombrew: https://brew.sh/#install
echo -e "${GREEN}Installing Homebrew${NOCOLOR}"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo -e "${GREEN}Installing Pyenv${NOCOLOR}"
brew update && \
brew install pyenv && \
eval "$(pyenv init -)" && \
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
brew install readline xz && \
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
fi;
echo -e "${GREEN}Retrieving latest Python versions${NOCOLOR}"
## Set latest Python 2/3
if [[ "$OSTYPE" == "linux-gnu" ]]; then
py2latest="$(pyenv install -l | grep -oP '^\s*2\.\d+\.(\d+)$' | sort -V | tail -n1)"
py3latest="3.8.6"
elif [[ "$OSTYPE" == "darwin"* ]]; then
py2latest="$(pyenv install -l | grep -oE '^\s*2\.\d+\.(\d+)$' | sort -V | tail -n1)"
py3latest="3.8.6"
fi;
echo "Latest Python 2: $py2latest" && \
echo "Latest Python 3: $py3latest" && \
## Install latest Python 2/3
echo -e "${GREEN}Installing Python versions${NOCOLOR}"
pyenv install $py2latest && \
pyenv install $py3latest && \
## Set global python
# Choose which Python to set as global.
# pyglobal=$py2latest
pyglobal=$py3latest # Note: Use Python2 if on Ubuntu14(trusty)
echo -e "${GREEN}Setting Global Python to ${pyglobal}.${NOCOLOR}"
pyenv global $pyglobal
echo -e "${GREEN}Listing Installed Python versions${NOCOLOR}"
pyenv versions
echo -e "${GREEN}Cloning integrations-core${NOCOLOR}"
git clone https://github.com/DataDog/integrations-core.git
echo -e "${GREEN}Cloning integrations-extras${NOCOLOR}"
git clone https://github.com/DataDog/integrations-extras.git
cd integrations-core/datadog_checks_dev/
pip install -r requirements-dev.txt
pip install -e .[cli]
cd -
ddev config set core $(pwd)/integrations-core
ddev config set extras $(pwd)/integrations-extras
echo -e "\n${GREEN}DONE. Manually run the following for good measure.${NOCOLOR} \n\nsource ~/.bashrc\n"