-
Notifications
You must be signed in to change notification settings - Fork 3
/
init-dev-env.sh
executable file
·63 lines (47 loc) · 1.3 KB
/
init-dev-env.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
#!/bin/bash
app='autoconstruccion'
python="python"
major=$($python -c 'import sys; print(sys.version_info[0])')
if [ $major -eq 2 ]
then
python='python3'
major=$($python -c 'import sys; print(sys.version_info[0])')
if [ $major -ge 3 ]
then echo
else
echo "Python 3 it's mandatory"
exit
fi
fi
minor=$($python -c 'import sys; print(sys.version_info[1])')
if [ $minor -lt 4 ]
then
echo "Minimun Python version supported it's 3.4"
exit
fi
echo "Using Python:" $python_version
echo $($python -V)
# create virtual environment
mkdir venv
$python -m venv ./venv
if [[ $? != 0 ]]; then
echo "module venv fails, maybe this is beacause debiand and ubuntu has a pip issue "
echo "http://askubuntu.com/questions/488529/pyvenv-3-4-error-returned-non-zero-exit-status-1"
echo "trying to install with a workaround"
$python -m venv --without-pip ./venv
source venvdir/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python
deactivate
fi ;
source ./venv/bin/activate
pip="$python -m pip"
if $( cat $pip | grep-i 'No module' ); then
echo "necesitas instalar pip"
fi ;
echo $($pip -V)
$pip install -r requirements-dev.txt
$pip install -r requirements.txt
#mkdir ./$app
# make development config file
mkdir ./$app/instance
touch ./$app/instance/config.py