-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap_dev.sh
More file actions
executable file
·69 lines (59 loc) · 1.85 KB
/
bootstrap_dev.sh
File metadata and controls
executable file
·69 lines (59 loc) · 1.85 KB
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
#!/usr/bin/env bash
set -e
#set -xv
#PS4='$LINENO: '
# This is the script for developers who want to contribute;
# run it to configure the necessary environment; please modify it if necessary
#
# Usage:
#
# git clone ...
# cd ...
# bash ./src/main/scripts/bootstrap_dev.sh
PY_VERSIONS=("2.7.14" "3.6.5")
VENV_PREFIX=qpyutil
#-------------------- config
if command -v proxychains4 > /dev/null ; then
PROXY=proxychains4
else
PROXY=
fi
if ! grep pyenv ~/.bash_profile > /dev/null ; then
cat >> ~/.bash_profile <<-'EOF'
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
EOF
fi
if [ ! -f ~/.pip/pip.conf ]; then
mkdir -p ~/.pip
cat >> ~/.pip/pip.conf <<-'EOF'
[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple
EOF
fi
#-------------------- ensure pyenv
if ! command -v pyenv > /dev/null ; then
$PROXY curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
fi
source ~/.bash_profile
#-------------------- virtualenv pybuilder
for PYVER in ${PY_VERSIONS[@]}; do
if ! pyenv versions | grep ${PYVER} > /dev/null ; then
$PROXY wget https://www.python.org/ftp/python/${PYVER}/Python-${PYVER}.tar.xz -P ~/.pyenv/cache/
pyenv install --skip-existing --verbose ${PYVER}
fi
VENV_NAME=${VENV_PREFIX}-${PYVER}
if ! pyenv virtualenvs | grep ${VENV_NAME} > /dev/null ; then
pyenv virtualenv ${PYVER} ${VENV_NAME}
pyenv activate ${VENV_NAME}
pip install -r requirements-dev.txt
echo "******************** preparing dev environment in python-${PYVER}"
pyb install_dependencies -v
fi
done
echo "---------- done configuring development environment"
echo -e "we are in:\n $(pyenv versions)\n"
echo "to switch: just type 'pyenv activate <venv_name>'"