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

Side by Side Diff: build/landmines.py

Issue 1947523002: Let landmines print something when run as part of `gclient sync`. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 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 script runs every build as the first hook (See DEPS). If it detects that 7 This script runs every build as the first hook (See DEPS). If it detects that
8 the build should be clobbered, it will delete the contents of the build 8 the build should be clobbered, it will delete the contents of the build
9 directory. 9 directory.
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if os.path.exists(landmines_path): 66 if os.path.exists(landmines_path):
67 with open(landmines_path, 'r') as f: 67 with open(landmines_path, 'r') as f:
68 old_landmines = f.readlines() 68 old_landmines = f.readlines()
69 if old_landmines != new_landmines: 69 if old_landmines != new_landmines:
70 old_date = time.ctime(os.stat(landmines_path).st_ctime) 70 old_date = time.ctime(os.stat(landmines_path).st_ctime)
71 diff = difflib.unified_diff(old_landmines, new_landmines, 71 diff = difflib.unified_diff(old_landmines, new_landmines,
72 fromfile='old_landmines', tofile='new_landmines', 72 fromfile='old_landmines', tofile='new_landmines',
73 fromfiledate=old_date, tofiledate=time.ctime(), n=0) 73 fromfiledate=old_date, tofiledate=time.ctime(), n=0)
74 sys.stdout.write('Clobbering due to:\n') 74 sys.stdout.write('Clobbering due to:\n')
75 sys.stdout.writelines(diff) 75 sys.stdout.writelines(diff)
76 sys.stdout.flush()
76 77
77 clobber.clobber(out_dir) 78 clobber.clobber(out_dir)
78 79
79 # Save current set of landmines for next time. 80 # Save current set of landmines for next time.
80 with open(landmines_path, 'w') as f: 81 with open(landmines_path, 'w') as f:
81 f.writelines(new_landmines) 82 f.writelines(new_landmines)
82 83
83 84
84 def process_options(): 85 def process_options():
85 """Returns an options object containing the configuration for this script.""" 86 """Returns an options object containing the configuration for this script."""
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) 139 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE)
139 output, _ = proc.communicate() 140 output, _ = proc.communicate()
140 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) 141 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()])
141 clobber_if_necessary(landmines, options.src_dir) 142 clobber_if_necessary(landmines, options.src_dir)
142 143
143 return 0 144 return 0
144 145
145 146
146 if __name__ == '__main__': 147 if __name__ == '__main__':
147 sys.exit(main()) 148 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