Chromium Code Reviews| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 | 259 |
| 260 section = None | 260 section = None |
| 261 chunk = [] | 261 chunk = [] |
| 262 # Is stdout a terminal which supports colors? | 262 # Is stdout a terminal which supports colors? |
| 263 is_fancy_tty = False | 263 is_fancy_tty = False |
| 264 clr_eol = None | 264 clr_eol = None |
| 265 if sys.stdout.isatty(): | 265 if sys.stdout.isatty(): |
| 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 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el']) | 269 try: |
| 270 if clr_eol: | 270 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'], |
| 271 is_fancy_tty = True | 271 stderr=subprocess.STDOUT) |
|
kustermann
2013/04/06 14:31:05
I don't understand why you added 'stderr=subproces
ahe
2013/04/08 12:46:29
tput is a well-behaved Unix command. It doesn't p
| |
| 272 if clr_eol: | |
| 273 is_fancy_tty = True | |
| 274 except subprocess.CalledProcessError: | |
| 275 is_fancy_tty = False | |
| 272 for line in unbuffered(process.stdout.readline): | 276 for line in unbuffered(process.stdout.readline): |
| 273 line = line.rstrip() | 277 line = line.rstrip() |
| 274 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): | 278 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): |
| 275 if not is_empty_chunk(chunk): | 279 if not is_empty_chunk(chunk): |
| 276 print '\n'.join(chunk) | 280 print '\n'.join(chunk) |
| 277 section = line | 281 section = line |
| 278 if is_fancy_tty: | 282 if is_fancy_tty: |
| 279 # If stdout is a terminal, emit "progress" information. The | 283 # If stdout is a terminal, emit "progress" information. The |
| 280 # progress information is the first line of the current chunk. | 284 # progress information is the first line of the current chunk. |
| 281 # After printing the line, move the cursor back to the | 285 # After printing the line, move the cursor back to the |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 process.wait() | 406 process.wait() |
| 403 if process.returncode != 0: | 407 if process.returncode != 0: |
| 404 print "BUILD FAILED" | 408 print "BUILD FAILED" |
| 405 return 1 | 409 return 1 |
| 406 | 410 |
| 407 return 0 | 411 return 0 |
| 408 | 412 |
| 409 | 413 |
| 410 if __name__ == '__main__': | 414 if __name__ == '__main__': |
| 411 sys.exit(Main()) | 415 sys.exit(Main()) |
| OLD | NEW |