OLD | NEW |
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 shutil | 10 import shutil |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 term = os.getenv('TERM', 'dumb') | 266 term = os.getenv('TERM', 'dumb') |
267 # The capability "clr_eol" means clear the line from cursor to end | 267 # The capability "clr_eol" means clear the line from cursor to end |
268 # of line. See man pages for tput and terminfo. | 268 # of line. See man pages for tput and terminfo. |
269 try: | 269 try: |
270 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'], | 270 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'], |
271 stderr=subprocess.STDOUT) | 271 stderr=subprocess.STDOUT) |
272 if clr_eol: | 272 if clr_eol: |
273 is_fancy_tty = True | 273 is_fancy_tty = True |
274 except subprocess.CalledProcessError: | 274 except subprocess.CalledProcessError: |
275 is_fancy_tty = False | 275 is_fancy_tty = False |
| 276 has_interesting_info = False |
276 for line in unbuffered(process.stdout.readline): | 277 for line in unbuffered(process.stdout.readline): |
277 line = line.rstrip() | 278 line = line.rstrip() |
278 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): | 279 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): |
279 if not is_empty_chunk(chunk): | 280 has_interesting_info = False |
280 print '\n'.join(chunk) | |
281 section = line | 281 section = line |
282 if is_fancy_tty: | 282 if is_fancy_tty: |
283 # If stdout is a terminal, emit "progress" information. The | 283 # If stdout is a terminal, emit "progress" information. The |
284 # progress information is the first line of the current chunk. | 284 # progress information is the first line of the current chunk. |
285 # After printing the line, move the cursor back to the | 285 # After printing the line, move the cursor back to the |
286 # beginning of the line. This has two effects: First, if the | 286 # beginning of the line. This has two effects: First, if the |
287 # chunk isn't empty, the first line will be overwritten | 287 # chunk isn't empty, the first line will be overwritten |
288 # (avoiding duplication). Second, the next segment line will | 288 # (avoiding duplication). Second, the next segment line will |
289 # overwrite it too avoid long scrollback. clr_eol ensures | 289 # overwrite it too avoid long scrollback. clr_eol ensures |
290 # that there is no trailing garbage when a shorter line | 290 # that there is no trailing garbage when a shorter line |
291 # overwrites a longer line. | 291 # overwrites a longer line. |
292 print '%s%s\r' % (clr_eol, section), | 292 print '%s%s\r' % (clr_eol, section), |
293 chunk = [] | 293 chunk = [] |
294 if not section: | 294 if not section or has_interesting_info: |
295 print line | 295 print line |
296 else: | 296 else: |
297 chunk.append(line) | 297 length = len(chunk) |
| 298 if length == 1 and line != 'Check dependencies': |
| 299 has_interesting_info = True |
| 300 elif (length == 2 or length == 3) and line: |
| 301 has_interesting_info = True |
| 302 if has_interesting_info: |
| 303 print '\n'.join(chunk) |
| 304 chunk = [] |
| 305 else: |
| 306 chunk.append(line) |
298 if not is_empty_chunk(chunk): | 307 if not is_empty_chunk(chunk): |
299 print '\n'.join(chunk) | 308 print '\n'.join(chunk) |
300 | 309 |
301 | 310 |
302 def Main(): | 311 def Main(): |
303 utils.ConfigureJava() | 312 utils.ConfigureJava() |
304 # Parse the options. | 313 # Parse the options. |
305 parser = BuildOptions() | 314 parser = BuildOptions() |
306 (options, args) = parser.parse_args() | 315 (options, args) = parser.parse_args() |
307 if not ProcessOptions(options, args): | 316 if not ProcessOptions(options, args): |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 process.wait() | 415 process.wait() |
407 if process.returncode != 0: | 416 if process.returncode != 0: |
408 print "BUILD FAILED" | 417 print "BUILD FAILED" |
409 return 1 | 418 return 1 |
410 | 419 |
411 return 0 | 420 return 0 |
412 | 421 |
413 | 422 |
414 if __name__ == '__main__': | 423 if __name__ == '__main__': |
415 sys.exit(Main()) | 424 sys.exit(Main()) |
OLD | NEW |