| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 shutil.copytree(source, dest) | 53 shutil.copytree(source, dest) |
| 54 elif extension == '.xib': | 54 elif extension == '.xib': |
| 55 return self._CopyXIBFile(source, dest) | 55 return self._CopyXIBFile(source, dest) |
| 56 elif extension == '.strings': | 56 elif extension == '.strings': |
| 57 self._CopyStringsFile(source, dest) | 57 self._CopyStringsFile(source, dest) |
| 58 else: | 58 else: |
| 59 shutil.copyfile(source, dest) | 59 shutil.copyfile(source, dest) |
| 60 | 60 |
| 61 def _CopyXIBFile(self, source, dest): | 61 def _CopyXIBFile(self, source, dest): |
| 62 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" | 62 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" |
| 63 tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin') | 63 args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', |
| 64 args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings', | 64 '--output-format', 'human-readable-text', '--compile', dest, source] |
| 65 '--notices', '--output-format', 'human-readable-text', '--compile', | |
| 66 dest, source] | |
| 67 ibtool_section_re = re.compile(r'/\*.*\*/') | 65 ibtool_section_re = re.compile(r'/\*.*\*/') |
| 68 ibtool_re = re.compile(r'.*note:.*is clipping its content') | 66 ibtool_re = re.compile(r'.*note:.*is clipping its content') |
| 69 ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) | 67 ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) |
| 70 current_section_header = None | 68 current_section_header = None |
| 71 for line in ibtoolout.stdout: | 69 for line in ibtoolout.stdout: |
| 72 if ibtool_section_re.match(line): | 70 if ibtool_section_re.match(line): |
| 73 current_section_header = line | 71 current_section_header = line |
| 74 elif not ibtool_re.match(line): | 72 elif not ibtool_re.match(line): |
| 75 if current_section_header: | 73 if current_section_header: |
| 76 sys.stdout.write(current_section_header) | 74 sys.stdout.write(current_section_header) |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 def _Relink(self, dest, link): | 242 def _Relink(self, dest, link): |
| 245 """Creates a symlink to |dest| named |link|. If |link| already exists, | 243 """Creates a symlink to |dest| named |link|. If |link| already exists, |
| 246 it is overwritten.""" | 244 it is overwritten.""" |
| 247 if os.path.lexists(link): | 245 if os.path.lexists(link): |
| 248 os.remove(link) | 246 os.remove(link) |
| 249 os.symlink(dest, link) | 247 os.symlink(dest, link) |
| 250 | 248 |
| 251 | 249 |
| 252 if __name__ == '__main__': | 250 if __name__ == '__main__': |
| 253 sys.exit(main(sys.argv[1:])) | 251 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |