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 ibtoolout = subprocess.Popen(ibtool_args, stdout=subprocess.PIPE) |
|
Robert Sesek
2017/06/22 15:13:04
Any reason to not use subprocess.check_output?
| |
| 44 ibtoolout.wait() | |
| 44 current_section_header = None | 45 current_section_header = None |
| 45 for line in ibtoolout.stdout: | 46 for line in ibtoolout.stdout: |
| 46 if ibtool_section_re.match(line): | 47 if ibtool_section_re.match(line): |
| 47 current_section_header = line | 48 current_section_header = line |
| 48 elif not ibtool_re.match(line): | 49 elif not ibtool_re.match(line): |
| 49 if current_section_header: | 50 if current_section_header: |
| 50 sys.stdout.write(current_section_header) | 51 sys.stdout.write(current_section_header) |
| 51 current_section_header = None | 52 current_section_header = None |
| 52 sys.stdout.write(line) | 53 sys.stdout.write(line) |
| 53 return ibtoolout.returncode | 54 return ibtoolout.returncode |
| 54 | 55 |
| 55 | 56 |
| 56 if __name__ == '__main__': | 57 if __name__ == '__main__': |
| 57 sys.exit(main()) | 58 sys.exit(main()) |
| OLD | NEW |