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

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

Issue 9407030: mac: Let `mac-tool flock` exit with the exit code of the child program. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 10 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
11 import fcntl 11 import fcntl
12 import os 12 import os
13 import plistlib 13 import plistlib
14 import re 14 import re
15 import shutil 15 import shutil
16 import string 16 import string
17 import subprocess 17 import subprocess
18 import sys 18 import sys
19 19
20 20
21 def main(args): 21 def main(args):
22 executor = MacTool() 22 executor = MacTool()
23 executor.Dispatch(args) 23 exit_code = executor.Dispatch(args)
24 if exit_code is not None:
25 sys.exit(exit_code)
24 26
25 27
26 class MacTool(object): 28 class MacTool(object):
27 """This class performs all the Mac tooling steps. The methods can either be 29 """This class performs all the Mac tooling steps. The methods can either be
28 executed directly, or dispatched from an argument list.""" 30 executed directly, or dispatched from an argument list."""
29 31
30 def Dispatch(self, args): 32 def Dispatch(self, args):
31 """Dispatches a string command to a method.""" 33 """Dispatches a string command to a method."""
32 if len(args) < 1: 34 if len(args) < 1:
33 raise Exception("Not enough arguments") 35 raise Exception("Not enough arguments")
34 36
35 method = "Exec%s" % self._CommandifyName(args[0]) 37 method = "Exec%s" % self._CommandifyName(args[0])
36 getattr(self, method)(*args[1:]) 38 return getattr(self, method)(*args[1:])
Nico 2012/02/16 02:13:46 ExecFlock() below does `return subprocess.call()`
37 39
38 def _CommandifyName(self, name_string): 40 def _CommandifyName(self, name_string):
39 """Transforms a tool name like copy-info-plist to CopyInfoPlist""" 41 """Transforms a tool name like copy-info-plist to CopyInfoPlist"""
40 return name_string.title().replace('-', '') 42 return name_string.title().replace('-', '')
41 43
42 def ExecCopyBundleResource(self, source, dest): 44 def ExecCopyBundleResource(self, source, dest):
43 """Copies a resource file to the bundle/Resources directory, performing any 45 """Copies a resource file to the bundle/Resources directory, performing any
44 necessary compilation on each resource.""" 46 necessary compilation on each resource."""
45 extension = os.path.splitext(source)[1].lower() 47 extension = os.path.splitext(source)[1].lower()
46 if os.path.isdir(source): 48 if os.path.isdir(source):
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 def _Relink(self, dest, link): 195 def _Relink(self, dest, link):
194 """Creates a symlink to |dest| named |link|. If |link| already exists, 196 """Creates a symlink to |dest| named |link|. If |link| already exists,
195 it is overwritten.""" 197 it is overwritten."""
196 if os.path.lexists(link): 198 if os.path.lexists(link):
197 os.remove(link) 199 os.remove(link)
198 os.symlink(dest, link) 200 os.symlink(dest, link)
199 201
200 202
201 if __name__ == '__main__': 203 if __name__ == '__main__':
202 sys.exit(main(sys.argv[1:])) 204 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