| 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 except AttributeError: |
| 277 is_fancy_tty = False |
| 276 for line in unbuffered(process.stdout.readline): | 278 for line in unbuffered(process.stdout.readline): |
| 277 line = line.rstrip() | 279 line = line.rstrip() |
| 278 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): | 280 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): |
| 279 if not is_empty_chunk(chunk): | 281 if not is_empty_chunk(chunk): |
| 280 print '\n'.join(chunk) | 282 print '\n'.join(chunk) |
| 281 section = line | 283 section = line |
| 282 if is_fancy_tty: | 284 if is_fancy_tty: |
| 283 # If stdout is a terminal, emit "progress" information. The | 285 # If stdout is a terminal, emit "progress" information. The |
| 284 # progress information is the first line of the current chunk. | 286 # progress information is the first line of the current chunk. |
| 285 # After printing the line, move the cursor back to the | 287 # After printing the line, move the cursor back to the |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 process.wait() | 408 process.wait() |
| 407 if process.returncode != 0: | 409 if process.returncode != 0: |
| 408 print "BUILD FAILED" | 410 print "BUILD FAILED" |
| 409 return 1 | 411 return 1 |
| 410 | 412 |
| 411 return 0 | 413 return 0 |
| 412 | 414 |
| 413 | 415 |
| 414 if __name__ == '__main__': | 416 if __name__ == '__main__': |
| 415 sys.exit(Main()) | 417 sys.exit(Main()) |
| OLD | NEW |