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

Side by Side Diff: dart/tools/build.py

Issue 13724018: Shorten "progress" information, and make sure it never extend 80 columns. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged Created 7 years, 8 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 | Annotate | Revision Log
« 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 # 2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import re
10 import shutil 11 import shutil
11 import subprocess 12 import subprocess
12 import sys 13 import sys
13 import utils 14 import utils
14 15
15 HOST_OS = utils.GuessOS() 16 HOST_OS = utils.GuessOS()
16 HOST_CPUS = utils.GuessCpus() 17 HOST_CPUS = utils.GuessCpus()
17 armcompilerlocation = '/opt/codesourcery/arm-2009q1' 18 armcompilerlocation = '/opt/codesourcery/arm-2009q1'
18 SCRIPT_DIR = os.path.dirname(sys.argv[0]) 19 SCRIPT_DIR = os.path.dirname(sys.argv[0])
19 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) 20 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 term = os.getenv('TERM', 'dumb') 267 term = os.getenv('TERM', 'dumb')
267 # The capability "clr_eol" means clear the line from cursor to end 268 # The capability "clr_eol" means clear the line from cursor to end
268 # of line. See man pages for tput and terminfo. 269 # of line. See man pages for tput and terminfo.
269 try: 270 try:
270 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'], 271 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'],
271 stderr=subprocess.STDOUT) 272 stderr=subprocess.STDOUT)
272 if clr_eol: 273 if clr_eol:
273 is_fancy_tty = True 274 is_fancy_tty = True
274 except subprocess.CalledProcessError: 275 except subprocess.CalledProcessError:
275 is_fancy_tty = False 276 is_fancy_tty = False
277 pattern = re.compile(r'=== BUILD .* TARGET (.*) OF PROJECT (.*) WITH ' +
278 r'CONFIGURATION (.*) ===')
276 has_interesting_info = False 279 has_interesting_info = False
277 for line in unbuffered(process.stdout.readline): 280 for line in unbuffered(process.stdout.readline):
278 line = line.rstrip() 281 line = line.rstrip()
279 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): 282 if line.startswith('=== BUILD ') or line.startswith('** BUILD '):
280 has_interesting_info = False 283 has_interesting_info = False
281 section = line 284 section = line
282 if is_fancy_tty: 285 if is_fancy_tty:
286 match = re.match(pattern, section)
287 if match:
288 section = '%s/%s/%s' % (
289 match.group(3), match.group(2), match.group(1))
290 # Truncate to avoid extending beyond 80 columns.
291 section = section[:80]
283 # If stdout is a terminal, emit "progress" information. The 292 # If stdout is a terminal, emit "progress" information. The
284 # progress information is the first line of the current chunk. 293 # progress information is the first line of the current chunk.
285 # After printing the line, move the cursor back to the 294 # After printing the line, move the cursor back to the
286 # beginning of the line. This has two effects: First, if the 295 # beginning of the line. This has two effects: First, if the
287 # chunk isn't empty, the first line will be overwritten 296 # chunk isn't empty, the first line will be overwritten
288 # (avoiding duplication). Second, the next segment line will 297 # (avoiding duplication). Second, the next segment line will
289 # overwrite it too avoid long scrollback. clr_eol ensures 298 # overwrite it too avoid long scrollback. clr_eol ensures
290 # that there is no trailing garbage when a shorter line 299 # that there is no trailing garbage when a shorter line
291 # overwrites a longer line. 300 # overwrites a longer line.
292 print '%s%s\r' % (clr_eol, section), 301 print '%s%s\r' % (clr_eol, section),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 process.wait() 423 process.wait()
415 if process.returncode != 0: 424 if process.returncode != 0:
416 print "BUILD FAILED" 425 print "BUILD FAILED"
417 return 1 426 return 1
418 427
419 return 0 428 return 0
420 429
421 430
422 if __name__ == '__main__': 431 if __name__ == '__main__':
423 sys.exit(Main()) 432 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