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

Side by Side Diff: build/landmines.py

Issue 11369238: Only show landmines output if the environment says so. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Change the env var to be better Created 8 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 This file holds a list of reasons why a particular build needs to be clobbered 7 This file holds a list of reasons why a particular build needs to be clobbered
8 (or a list of 'landmines'). 8 (or a list of 'landmines').
9 9
10 This script runs every build as a hook. If it detects that the build should 10 This script runs every build as a hook. If it detects that the build should
(...skipping 18 matching lines...) Expand all
29 29
30 def memoize(default=None): 30 def memoize(default=None):
31 """This decorator caches the return value of a parameterless pure function""" 31 """This decorator caches the return value of a parameterless pure function"""
32 def memoizer(func): 32 def memoizer(func):
33 val = [] 33 val = []
34 @functools.wraps(func) 34 @functools.wraps(func)
35 def inner(): 35 def inner():
36 if not val: 36 if not val:
37 ret = func() 37 ret = func()
38 val.append(ret if ret is not None else default) 38 val.append(ret if ret is not None else default)
39 print '%s -> %r' % (func.__name__, val[0]) 39 if 'LANDMINES_VERBOSE' in os.environ:
M-A Ruel 2012/11/14 13:03:36 I prefer when you use a --verbose flag and default
40 print '%s -> %r' % (func.__name__, val[0])
40 return val[0] 41 return val[0]
41 return inner 42 return inner
42 return memoizer 43 return memoizer
43 44
44 45
45 @memoize() 46 @memoize()
46 def IsWindows(): 47 def IsWindows():
47 return sys.platform.startswith('win') or sys.platform == 'cygwin' 48 return sys.platform.startswith('win') or sys.platform == 'cygwin'
48 49
49 50
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 f.writelines(diff) 202 f.writelines(diff)
202 elif os.path.exists(triggered): 203 elif os.path.exists(triggered):
203 # Remove false triggered landmines. 204 # Remove false triggered landmines.
204 os.remove(triggered) 205 os.remove(triggered)
205 206
206 return 0 207 return 0
207 208
208 209
209 if __name__ == '__main__': 210 if __name__ == '__main__':
210 sys.exit(main(sys.argv)) 211 sys.exit(main(sys.argv))
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