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

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

Issue 61293004: ninja generator vs file permissions (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | test/copies/gyptest-attribs.py » ('j') | 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 30 matching lines...) Expand all
41 def _CommandifyName(self, name_string): 41 def _CommandifyName(self, name_string):
42 """Transforms a tool name like copy-info-plist to CopyInfoPlist""" 42 """Transforms a tool name like copy-info-plist to CopyInfoPlist"""
43 return name_string.title().replace('-', '') 43 return name_string.title().replace('-', '')
44 44
45 def ExecCopyBundleResource(self, source, dest): 45 def ExecCopyBundleResource(self, source, dest):
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 # TODO(thakis): This copies file attributes like mtime, while the
52 # single-file branch below doesn't. This should probably be changed to
53 # be consistent with the single-file branch.
51 if os.path.exists(dest): 54 if os.path.exists(dest):
52 shutil.rmtree(dest) 55 shutil.rmtree(dest)
53 shutil.copytree(source, dest) 56 shutil.copytree(source, dest)
54 elif extension == '.xib': 57 elif extension == '.xib':
55 return self._CopyXIBFile(source, dest) 58 return self._CopyXIBFile(source, dest)
56 elif extension == '.storyboard': 59 elif extension == '.storyboard':
57 return self._CopyXIBFile(source, dest) 60 return self._CopyXIBFile(source, dest)
58 elif extension == '.strings': 61 elif extension == '.strings':
59 self._CopyStringsFile(source, dest) 62 self._CopyStringsFile(source, dest)
60 else: 63 else:
61 shutil.copyfile(source, dest) 64 shutil.copy(source, dest)
62 65
63 def _CopyXIBFile(self, source, dest): 66 def _CopyXIBFile(self, source, dest):
64 """Compiles a XIB file with ibtool into a binary plist in the bundle.""" 67 """Compiles a XIB file with ibtool into a binary plist in the bundle."""
65 68
66 # ibtool sometimes crashes with relative paths. See crbug.com/314728. 69 # ibtool sometimes crashes with relative paths. See crbug.com/314728.
67 base = os.path.dirname(os.path.realpath(__file__)) 70 base = os.path.dirname(os.path.realpath(__file__))
68 if os.path.relpath(source): 71 if os.path.relpath(source):
69 source = os.path.join(base, source) 72 source = os.path.join(base, source)
70 if os.path.relpath(dest): 73 if os.path.relpath(dest):
71 dest = os.path.join(base, dest) 74 dest = os.path.join(base, dest)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 def _Relink(self, dest, link): 255 def _Relink(self, dest, link):
253 """Creates a symlink to |dest| named |link|. If |link| already exists, 256 """Creates a symlink to |dest| named |link|. If |link| already exists,
254 it is overwritten.""" 257 it is overwritten."""
255 if os.path.lexists(link): 258 if os.path.lexists(link):
256 os.remove(link) 259 os.remove(link)
257 os.symlink(dest, link) 260 os.symlink(dest, link)
258 261
259 262
260 if __name__ == '__main__': 263 if __name__ == '__main__':
261 sys.exit(main(sys.argv[1:])) 264 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | test/copies/gyptest-attribs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698