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

Side by Side Diff: cit.py

Issue 2062053002: cit: print to stderr to allow piping from cit log cat. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 6
7 """Wrapper for updating and calling infra.git tools. 7 """Wrapper for updating and calling infra.git tools.
8 8
9 This tool does a two things: 9 This tool does a two things:
10 * Maintains a infra.git checkout pinned at "deployed" in the home dir 10 * Maintains a infra.git checkout pinned at "deployed" in the home dir
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 subprocess.check_call( 50 subprocess.check_call(
51 ['git', 'fetch', 'origin'], cwd=INFRA_DIR, 51 ['git', 'fetch', 'origin'], cwd=INFRA_DIR,
52 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 52 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
53 origin_rev = get_git_rev(INFRA_DIR, 'origin/%s' % (branch,)) 53 origin_rev = get_git_rev(INFRA_DIR, 'origin/%s' % (branch,))
54 return origin_rev != local_rev 54 return origin_rev != local_rev
55 55
56 56
57 def ensure_infra(branch): 57 def ensure_infra(branch):
58 """Ensures that infra.git is present in ~/.chrome-infra.""" 58 """Ensures that infra.git is present in ~/.chrome-infra."""
59 print 'Fetching infra@%s into %s, may take a couple of minutes...' % ( 59 sys.stderr.write(
Ryan Tseng 2016/06/14 17:41:08 use print >>sys.stderr, "..." Either that, or add
tandrii(chromium) 2016/06/14 18:09:40 Actually, the whole reason for using stderr.write
60 branch, TARGET_DIR) 60 'Fetching infra@%s into %s, may take a couple of minutes...' % (
61 branch, TARGET_DIR))
62 sys.stderr.flush()
61 if not os.path.isdir(TARGET_DIR): 63 if not os.path.isdir(TARGET_DIR):
62 os.mkdir(TARGET_DIR) 64 os.mkdir(TARGET_DIR)
63 if not os.path.exists(os.path.join(TARGET_DIR, '.gclient')): 65 if not os.path.exists(os.path.join(TARGET_DIR, '.gclient')):
64 subprocess.check_call( 66 subprocess.check_call(
65 [sys.executable, os.path.join(SCRIPT_DIR, 'fetch.py'), 'infra'], 67 [sys.executable, os.path.join(SCRIPT_DIR, 'fetch.py'), 'infra'],
66 cwd=TARGET_DIR, 68 cwd=TARGET_DIR,
67 stdout=subprocess.PIPE) 69 stdout=subprocess.PIPE)
68 subprocess.check_call( 70 subprocess.check_call(
69 [sys.executable, GCLIENT, 'sync', '--revision', 'origin/%s' % (branch,)], 71 [sys.executable, GCLIENT, 'sync', '--revision', 'origin/%s' % (branch,)],
70 cwd=TARGET_DIR, 72 cwd=TARGET_DIR,
71 stdout=subprocess.PIPE) 73 stdout=subprocess.PIPE)
74 sys.stderr.write(' done.\n')
75 sys.stderr.flush()
72 76
73 77
74 def get_available_tools(): 78 def get_available_tools():
75 tools = [] 79 tools = []
76 starting = os.path.join(TARGET_DIR, 'infra', 'infra', 'tools') 80 starting = os.path.join(TARGET_DIR, 'infra', 'infra', 'tools')
77 for root, _, files in os.walk(starting): 81 for root, _, files in os.walk(starting):
78 if '__main__.py' in files: 82 if '__main__.py' in files:
79 tools.append(root[len(starting)+1:].replace(os.path.sep, '.')) 83 tools.append(root[len(starting)+1:].replace(os.path.sep, '.'))
80 return sorted(tools) 84 return sorted(tools)
81 85
(...skipping 29 matching lines...) Expand all
111 args.args.pop(0) 115 args.args.pop(0)
112 if extras: 116 if extras:
113 args.args = extras + args.args 117 args.args = extras + args.args
114 118
115 if need_to_update(args.infra_branch): 119 if need_to_update(args.infra_branch):
116 ensure_infra(args.infra_branch) 120 ensure_infra(args.infra_branch)
117 return run(args.args) 121 return run(args.args)
118 122
119 if __name__ == '__main__': 123 if __name__ == '__main__':
120 sys.exit(main()) 124 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698