forked from ploneintranet/ploneintranet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.py
32 lines (28 loc) · 1.05 KB
/
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
29
30
31
32
from subprocess import CalledProcessError
from subprocess import check_call
import os
import shlex
import sys
python_path = sys.executable
bin_dir = os.path.dirname(python_path)
pip_path = os.path.join(bin_dir, "pip")
out_path = "{0}/bin".format(os.getcwd())
bootstrap_clean = "{0} uninstall -y zc.buildout".format(pip_path)
bootstrap = (
'{0} install -r requirements.txt --install-option="--install-scripts={1}"'
).format(pip_path, out_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(shlex.split(bootstrap))
print "Bootstrap complete"
except CalledProcessError:
print "Please try to bootstrap manually using: {0}".format(bootstrap)