-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbootstrap.py
28 lines (24 loc) · 956 Bytes
/
bootstrap.py
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
from subprocess import CalledProcessError
from subprocess import check_call
import os
import sys
python_path = sys.executable
bin_dir = os.path.dirname(python_path)
pip_path = os.path.join(bin_dir, "pip")
bootstrap_clean = "{0} uninstall -y zc.buildout".format(pip_path)
bootstrap = "{0} install -r requirements.txt".format(pip_path)
if not os.path.exists(pip_path):
print ("pip is not installed in your virtualenv. Reinstall your "
"virtualenv without using the --no-setuptools or --no-pip options.")
sys.exit(1)
try:
print "Cleaning up from previous bootstrap: {0}".format(bootstrap_clean)
check_call(bootstrap_clean.split(" "))
except CalledProcessError:
print "Ready for bootstrap"
try:
print "Running bootstrap command: {0}".format(bootstrap)
check_call(bootstrap.split(" "))
print "Bootstrap complete"
except CalledProcessError:
print "Please try to bootstrap manually using: {0}".format(bootstrap)