Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import subprocess | 10 import subprocess |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 ] | 33 ] |
| 34 ibtool_args += unknown_args | 34 ibtool_args += unknown_args |
| 35 ibtool_args += [ | 35 ibtool_args += [ |
| 36 '--compile', | 36 '--compile', |
| 37 os.path.abspath(args.output), | 37 os.path.abspath(args.output), |
| 38 os.path.abspath(args.input) | 38 os.path.abspath(args.input) |
| 39 ] | 39 ] |
| 40 | 40 |
| 41 ibtool_section_re = re.compile(r'/\*.*\*/') | 41 ibtool_section_re = re.compile(r'/\*.*\*/') |
| 42 ibtool_re = re.compile(r'.*note:.*is clipping its content') | 42 ibtool_re = re.compile(r'.*note:.*is clipping its content') |
| 43 ibtoolout = subprocess.Popen(ibtool_args, stdout=subprocess.PIPE) | 43 try: |
| 44 stdout = subprocess.check_output(ibtool_args) | |
| 45 except subprocess.CalledProcessError as e: | |
| 46 print e.output | |
| 47 raise | |
| 44 current_section_header = None | 48 current_section_header = None |
| 45 for line in ibtoolout.stdout: | 49 for line in stdout.splitlines(): |
| 46 if ibtool_section_re.match(line): | 50 if ibtool_section_re.match(line): |
| 47 current_section_header = line | 51 current_section_header = line |
| 48 elif not ibtool_re.match(line): | 52 elif not ibtool_re.match(line): |
| 49 if current_section_header: | 53 if current_section_header: |
| 50 sys.stdout.write(current_section_header) | 54 print current_section_header |
|
sdefresne
2017/06/23 16:48:57
nit: can you either use "print(ccurent_section_hea
| |
| 51 current_section_header = None | 55 current_section_header = None |
| 52 sys.stdout.write(line) | 56 print line |
| 53 return ibtoolout.returncode | 57 return 0 |
| 54 | 58 |
| 55 | 59 |
| 56 if __name__ == '__main__': | 60 if __name__ == '__main__': |
| 57 sys.exit(main()) | 61 sys.exit(main()) |
| OLD | NEW |