| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 """Copies a resource file to the bundle/Resources directory, performing any | 46 """Copies a resource file to the bundle/Resources directory, performing any |
| 47 necessary compilation on each resource.""" | 47 necessary compilation on each resource.""" |
| 48 extension = os.path.splitext(source)[1].lower() | 48 extension = os.path.splitext(source)[1].lower() |
| 49 if os.path.isdir(source): | 49 if os.path.isdir(source): |
| 50 # Copy tree. | 50 # Copy tree. |
| 51 if os.path.exists(dest): | 51 if os.path.exists(dest): |
| 52 shutil.rmtree(dest) | 52 shutil.rmtree(dest) |
| 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 == '.storyboard': |
| 57 return self._CopyXIBFile(source, dest) |
| 56 elif extension == '.strings': | 58 elif extension == '.strings': |
| 57 self._CopyStringsFile(source, dest) | 59 self._CopyStringsFile(source, dest) |
| 58 else: | 60 else: |
| 59 shutil.copyfile(source, dest) | 61 shutil.copyfile(source, dest) |
| 60 | 62 |
| 61 def _CopyXIBFile(self, source, dest): | 63 def _CopyXIBFile(self, source, dest): |
| 62 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" | 64 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" |
| 63 tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin') | 65 tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin') |
| 64 args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings', | 66 args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings', |
| 65 '--notices', '--output-format', 'human-readable-text', '--compile', | 67 '--notices', '--output-format', 'human-readable-text', '--compile', |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 def _Relink(self, dest, link): | 246 def _Relink(self, dest, link): |
| 245 """Creates a symlink to |dest| named |link|. If |link| already exists, | 247 """Creates a symlink to |dest| named |link|. If |link| already exists, |
| 246 it is overwritten.""" | 248 it is overwritten.""" |
| 247 if os.path.lexists(link): | 249 if os.path.lexists(link): |
| 248 os.remove(link) | 250 os.remove(link) |
| 249 os.symlink(dest, link) | 251 os.symlink(dest, link) |
| 250 | 252 |
| 251 | 253 |
| 252 if __name__ == '__main__': | 254 if __name__ == '__main__': |
| 253 sys.exit(main(sys.argv[1:])) | 255 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |