Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: scripts/slave/recipe_modules/cipd/resources/ensure.py

Issue 1193813004: cipd recipe_module (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: added ensure_installed Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 import json
2 import os
3 import subprocess
4 import sys
5
6 def execute(cmd):
7 """Runs a subprocess redirecting its stdout and stderr to the log.
8
9 Args:
10 cmd: list with command line arguments.
11
12 Returns:
13 Process exit code.
14 """
15 print('Running ' + ' '.join(cmd))
16 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
17 line = ''
18 while True:
19 buf = proc.stdout.read(1)
20 if not buf:
21 if line:
22 print(line.strip())
23 break
24 if buf == '\n':
25 print(line.strip())
26 line = ''
27 else:
28 line += buf
29 code = proc.wait()
30 if code:
31 print('Failed with exit code: %d', code)
32 return code
33
34
35 def main():
36 data = json.load(sys.stdin)
37 pkg_list = data['list']
38 root = data['root']
39
40 exit_code = 0
41 # return if this client version is already installed.
42
43 exit_code = execute(["./cipd", "ensure", "--root=%s" % root, "--list=%s" % pkg _list])
44 return exit_code
45
46 if __name__ == '__main__':
47 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698