-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvenv.sh
More file actions
executable file
·40 lines (31 loc) · 977 Bytes
/
venv.sh
File metadata and controls
executable file
·40 lines (31 loc) · 977 Bytes
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
#!/bin/bash
# variable for the virtualenv
VIRTUALENV=venv
# if venv exists use and if not, create it
if [ -e "$VIRTUALENV" ]
then
echo "Re-using existing virtualenv"
. $VIRTUALENV/bin/activate
else
virtualenv --no-site-packages $VIRTUALENV || { echo "Virtualenv failed"; exit -1; }
. $VIRTUALENV/bin/activate
easy_install -U setuptools
easy_install pip
rm -f md5.requirements.last
fi
# get a hash for the requirements
cat requirements.txt | md5sum > current.md5
# diff the two together
diff current.md5 previous.md5
# assign return of last command to variable
REQUIREMENTS_DIFF=$?
# if there was a diff reinstall the requirements
if [ "$REQUIREMENTS_DIFF" -ne 0 ]
then
# install the requiremnts or fail
pip install -r requirements.txt --timeout=100 --use-mirrors || { echo "pip fail"; exit -1; }
# mv the current md5 to previous
mv current.md5 previous.md5
fi
# now delete all .pyc files
find . -name "*.pyc" -exec rm {} \;