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

Side by Side Diff: lib/cros_build_lib.py

Issue 5573007: Add some desired options to the au test harness. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Change exceptions Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « image_to_live.sh ('k') | 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 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Common python commands used by various build scripts.""" 5 """Common python commands used by various build scripts."""
6 6
7 import inspect 7 import inspect
8 import os 8 import os
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 171
172 def Die(message): 172 def Die(message):
173 """Emits a red error message and halts execution. 173 """Emits a red error message and halts execution.
174 174
175 Keyword arguments: 175 Keyword arguments:
176 message: The message to be emitted before exiting. 176 message: The message to be emitted before exiting.
177 """ 177 """
178 print >> sys.stderr, ( 178 print >> sys.stderr, (
179 Color(_STDOUT_IS_TTY).Color(Color.RED, '\nERROR: ' + message)) 179 Color(_STDOUT_IS_TTY).Color(Color.RED, '\nERROR: ' + message))
180 sys.stderr.flush()
180 sys.exit(1) 181 sys.exit(1)
181 182
182 183
183 def Warning(message): 184 def Warning(message):
184 """Emits a yellow warning message and continues execution. 185 """Emits a yellow warning message and continues execution.
185 186
186 Keyword arguments: 187 Keyword arguments:
187 message: The message to be emitted. 188 message: The message to be emitted.
188 """ 189 """
189 print >> sys.stderr, ( 190 print >> sys.stderr, (
190 Color(_STDOUT_IS_TTY).Color(Color.YELLOW, '\nWARNING: ' + message)) 191 Color(_STDOUT_IS_TTY).Color(Color.YELLOW, '\nWARNING: ' + message))
192 sys.stderr.flush()
191 193
192 194
193 def Info(message): 195 def Info(message):
194 """Emits a blue informational message and continues execution. 196 """Emits a blue informational message and continues execution.
195 197
196 Keyword arguments: 198 Keyword arguments:
197 message: The message to be emitted. 199 message: The message to be emitted.
198 """ 200 """
199 print >> sys.stderr, ( 201 print >> sys.stderr, (
200 Color(_STDOUT_IS_TTY).Color(Color.BLUE, '\nINFO: ' + message)) 202 Color(_STDOUT_IS_TTY).Color(Color.BLUE, '\nINFO: ' + message))
203 sys.stderr.flush()
201 204
202 205
203 def FindRepoDir(path=None): 206 def FindRepoDir(path=None):
204 """Returns the nearest higher-level repo dir from the specified path. 207 """Returns the nearest higher-level repo dir from the specified path.
205 208
206 Args: 209 Args:
207 path: The path to use. Defaults to cwd. 210 path: The path to use. Defaults to cwd.
208 """ 211 """
209 if path is None: 212 if path is None:
210 path = os.getcwd() 213 path = os.getcwd()
(...skipping 18 matching lines...) Expand all
229 root_abs_path = os.path.abspath(root_path) 232 root_abs_path = os.path.abspath(root_path)
230 233
231 # Strip the repository root from the path and strip first /. 234 # Strip the repository root from the path and strip first /.
232 relative_path = path_abs_path.replace(root_abs_path, '')[1:] 235 relative_path = path_abs_path.replace(root_abs_path, '')[1:]
233 236
234 if relative_path == path_abs_path: 237 if relative_path == path_abs_path:
235 raise Exception('Error: path is outside your src tree, cannot reinterpret.') 238 raise Exception('Error: path is outside your src tree, cannot reinterpret.')
236 239
237 new_path = os.path.join('/home', os.getenv('USER'), 'trunk', relative_path) 240 new_path = os.path.join('/home', os.getenv('USER'), 'trunk', relative_path)
238 return new_path 241 return new_path
OLDNEW
« no previous file with comments | « image_to_live.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698