-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathinstall
executable file
·39 lines (32 loc) · 1.03 KB
/
install
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
#!/usr/bin/env python2.7
"""
Script for installing multivac, including auto-gen necessary code.
"""
import os
import subprocess
def execute(cmds, realtime_output=False):
p = subprocess.Popen(cmds, stdout=subprocess.PIPE)
if realtime_output:
while p.poll() is None:
l = p.stdout.readline() # This blocks until it receives a newline.
print l
print p.stdout.read()
else:
return p.communicate()
def gen_code():
print "Generating code..."
go_pkgs = execute(["go", "list", "-f", "{{.Dir}}", "./..."])[0].split()
for p in go_pkgs:
os.chdir(p)
subprocess.check_call(["go", "generate"])
def wire_download():
subprocess.call("go get github.com/google/wire/cmd/wire", shell=True)
if __name__ == "__main__":
wire_download()
root_path = os.path.abspath(os.path.join(os.path.abspath(__file__), os.pardir))
os.chdir(root_path)
gen_code()
print "Installing..."
os.chdir(root_path)
subprocess.check_call(["go", "install"])
print 'Complete'