Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: pylib/gyp/mac_tool.py

Issue 10383117: Don't retrict the file types that can be added as bundle resources. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 extension = os.path.splitext(source)[1].lower() 47 extension = os.path.splitext(source)[1].lower()
48 if os.path.isdir(source): 48 if os.path.isdir(source):
49 # Copy tree. 49 # Copy tree.
50 if os.path.exists(dest): 50 if os.path.exists(dest):
51 shutil.rmtree(dest) 51 shutil.rmtree(dest)
52 shutil.copytree(source, dest) 52 shutil.copytree(source, dest)
53 elif extension == '.xib': 53 elif extension == '.xib':
54 return self._CopyXIBFile(source, dest) 54 return self._CopyXIBFile(source, dest)
55 elif extension == '.strings': 55 elif extension == '.strings':
56 self._CopyStringsFile(source, dest) 56 self._CopyStringsFile(source, dest)
57 # TODO: Given that files with arbitrary extensions can be copied to the 57 else:
58 # bundle, we will want to get rid of this whitelist eventually.
59 elif extension in [
60 '.icns', '.manifest', '.pak', '.pdf', '.png', '.sb', '.sh',
61 '.ttf', '.sdef']:
62 shutil.copyfile(source, dest) 58 shutil.copyfile(source, dest)
63 else:
64 raise NotImplementedError(
65 "Don't know how to copy bundle resources of type %s while copying "
66 "%s to %s)" % (extension, source, dest))
67 59
68 def _CopyXIBFile(self, source, dest): 60 def _CopyXIBFile(self, source, dest):
69 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" 61 """Compiles a XIB file with ibtool into a binary plist in the bundle."""
70 tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin') 62 tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin')
71 args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings', 63 args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings',
72 '--notices', '--output-format', 'human-readable-text', '--compile', 64 '--notices', '--output-format', 'human-readable-text', '--compile',
73 dest, source] 65 dest, source]
74 ibtool_section_re = re.compile(r'/\*.*\*/') 66 ibtool_section_re = re.compile(r'/\*.*\*/')
75 ibtool_re = re.compile(r'.*note:.*is clipping its content') 67 ibtool_re = re.compile(r'.*note:.*is clipping its content')
76 ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) 68 ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE)
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 def _Relink(self, dest, link): 200 def _Relink(self, dest, link):
209 """Creates a symlink to |dest| named |link|. If |link| already exists, 201 """Creates a symlink to |dest| named |link|. If |link| already exists,
210 it is overwritten.""" 202 it is overwritten."""
211 if os.path.lexists(link): 203 if os.path.lexists(link):
212 os.remove(link) 204 os.remove(link)
213 os.symlink(dest, link) 205 os.symlink(dest, link)
214 206
215 207
216 if __name__ == '__main__': 208 if __name__ == '__main__':
217 sys.exit(main(sys.argv[1:])) 209 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698