| 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 re | 10 import re |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 # 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 |
| 269 # of line. See man pages for tput and terminfo. | 269 # of line. See man pages for tput and terminfo. |
| 270 try: | 270 try: |
| 271 with open('/dev/null', 'a') as dev_null: | 271 with open('/dev/null', 'a') as dev_null: |
| 272 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'], | 272 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'], |
| 273 stderr=dev_null) | 273 stderr=dev_null) |
| 274 if clr_eol: | 274 if clr_eol: |
| 275 is_fancy_tty = True | 275 is_fancy_tty = True |
| 276 except subprocess.CalledProcessError: | 276 except subprocess.CalledProcessError: |
| 277 is_fancy_tty = False | 277 is_fancy_tty = False |
| 278 except AttributeError: |
| 279 is_fancy_tty = False |
| 278 pattern = re.compile(r'=== BUILD .* TARGET (.*) OF PROJECT (.*) WITH ' + | 280 pattern = re.compile(r'=== BUILD .* TARGET (.*) OF PROJECT (.*) WITH ' + |
| 279 r'CONFIGURATION (.*) ===') | 281 r'CONFIGURATION (.*) ===') |
| 280 has_interesting_info = False | 282 has_interesting_info = False |
| 281 for line in unbuffered(process.stdout.readline): | 283 for line in unbuffered(process.stdout.readline): |
| 282 line = line.rstrip() | 284 line = line.rstrip() |
| 283 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): | 285 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): |
| 284 has_interesting_info = False | 286 has_interesting_info = False |
| 285 section = line | 287 section = line |
| 286 if is_fancy_tty: | 288 if is_fancy_tty: |
| 287 match = re.match(pattern, section) | 289 match = re.match(pattern, section) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 process.wait() | 428 process.wait() |
| 427 if process.returncode != 0: | 429 if process.returncode != 0: |
| 428 print "BUILD FAILED" | 430 print "BUILD FAILED" |
| 429 return 1 | 431 return 1 |
| 430 | 432 |
| 431 return 0 | 433 return 0 |
| 432 | 434 |
| 433 | 435 |
| 434 if __name__ == '__main__': | 436 if __name__ == '__main__': |
| 435 sys.exit(Main()) | 437 sys.exit(Main()) |
| OLD | NEW |