-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.py
executable file
·33 lines (27 loc) · 987 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
29
30
31
32
33
#!/usr/bin/env python
# bootstrap.py
# Bootstrap and setup a virtualenv with the specified requirements.txt
import os
import sys
import shutil
import subprocess
from optparse import OptionParser
usage = """usage: %prog [options]"""
parser = OptionParser(usage=usage)
parser.add_option("-c", "--clear", dest="clear", action="store_true",
help="clear out existing virtualenv")
def main():
if "VIRTUAL_ENV" not in os.environ:
sys.stderr.write("$VIRTUAL_ENV not found.\n\n")
parser.print_usage()
sys.exit(-1)
(options, pos_args) = parser.parse_args()
virtualenv = os.environ["VIRTUAL_ENV"]
if options.clear:
subprocess.call(["virtualenv", "--clear", "--distribute", virtualenv])
file_path = os.path.dirname(__file__)
subprocess.call(["pip", "install", "-E", virtualenv, "--requirement",
os.path.join(file_path, "requirements/dev.txt")])
if __name__ == "__main__":
main()
sys.exit(0)