OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 Google Inc. All rights reserved. | 2 # Copyright (c) 2012 Google Inc. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Utility functions to perform Xcode-style build steps. | 6 """Utility functions to perform Xcode-style build steps. |
7 | 7 |
8 These functions are executed via gyp-mac-tool when using the Makefile generator. | 8 These functions are executed via gyp-mac-tool when using the Makefile generator. |
9 """ | 9 """ |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" | 73 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" |
74 | 74 |
75 # ibtool sometimes crashes with relative paths. See crbug.com/314728. | 75 # ibtool sometimes crashes with relative paths. See crbug.com/314728. |
76 base = os.path.dirname(os.path.realpath(__file__)) | 76 base = os.path.dirname(os.path.realpath(__file__)) |
77 if os.path.relpath(source): | 77 if os.path.relpath(source): |
78 source = os.path.join(base, source) | 78 source = os.path.join(base, source) |
79 if os.path.relpath(dest): | 79 if os.path.relpath(dest): |
80 dest = os.path.join(base, dest) | 80 dest = os.path.join(base, dest) |
81 | 81 |
82 args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', | 82 args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', |
83 '--output-format', 'human-readable-text', '--compile', dest, source] | 83 '--auto-activate-custom-fonts', '--output-format', |
Nico
2016/01/26 22:55:11
do we want this on os x too?
sdefresne
2016/01/27 09:24:11
What is the earliest version of Xcode supporting t
| |
84 'human-readable-text', '--compile', dest, source] | |
84 ibtool_section_re = re.compile(r'/\*.*\*/') | 85 ibtool_section_re = re.compile(r'/\*.*\*/') |
85 ibtool_re = re.compile(r'.*note:.*is clipping its content') | 86 ibtool_re = re.compile(r'.*note:.*is clipping its content') |
86 ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) | 87 ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) |
87 current_section_header = None | 88 current_section_header = None |
88 for line in ibtoolout.stdout: | 89 for line in ibtoolout.stdout: |
89 if ibtool_section_re.match(line): | 90 if ibtool_section_re.match(line): |
90 current_section_header = line | 91 current_section_header = line |
91 elif not ibtool_re.match(line): | 92 elif not ibtool_re.match(line): |
92 if current_section_header: | 93 if current_section_header: |
93 sys.stdout.write(current_section_header) | 94 sys.stdout.write(current_section_header) |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
578 data = data.replace('$(%s)' % key, value) | 579 data = data.replace('$(%s)' % key, value) |
579 return data | 580 return data |
580 if isinstance(data, list): | 581 if isinstance(data, list): |
581 return [self._ExpandVariables(v, substitutions) for v in data] | 582 return [self._ExpandVariables(v, substitutions) for v in data] |
582 if isinstance(data, dict): | 583 if isinstance(data, dict): |
583 return {k: self._ExpandVariables(data[k], substitutions) for k in data} | 584 return {k: self._ExpandVariables(data[k], substitutions) for k in data} |
584 return data | 585 return data |
585 | 586 |
586 if __name__ == '__main__': | 587 if __name__ == '__main__': |
587 sys.exit(main(sys.argv[1:])) | 588 sys.exit(main(sys.argv[1:])) |
OLD | NEW |