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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 fp.close() | 193 fp.close() |
194 | 194 |
195 def ExecFlock(self, lockfile, *cmd_list): | 195 def ExecFlock(self, lockfile, *cmd_list): |
196 """Emulates the most basic behavior of Linux's flock(1).""" | 196 """Emulates the most basic behavior of Linux's flock(1).""" |
197 # Rely on exception handling to report errors. | 197 # Rely on exception handling to report errors. |
198 fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) | 198 fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) |
199 fcntl.flock(fd, fcntl.LOCK_EX) | 199 fcntl.flock(fd, fcntl.LOCK_EX) |
200 return subprocess.call(cmd_list) | 200 return subprocess.call(cmd_list) |
201 | 201 |
202 def ExecFilterLibtool(self, *cmd_list): | 202 def ExecFilterLibtool(self, *cmd_list): |
203 """Calls libtool and filters out 'libtool: file: foo.o has no symbols'.""" | 203 """Calls libtool and filters out '/path/to/libtool: file: foo.o has no |
204 libtool_re = re.compile(r'^libtool: file: .* has no symbols$') | 204 symbols'.""" |
| 205 libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') |
205 libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) | 206 libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) |
206 _, err = libtoolout.communicate() | 207 _, err = libtoolout.communicate() |
207 for line in err.splitlines(): | 208 for line in err.splitlines(): |
208 if not libtool_re.match(line): | 209 if not libtool_re.match(line): |
209 print >>sys.stderr, line | 210 print >>sys.stderr, line |
210 return libtoolout.returncode | 211 return libtoolout.returncode |
211 | 212 |
212 def ExecPackageFramework(self, framework, version): | 213 def ExecPackageFramework(self, framework, version): |
213 """Takes a path to Something.framework and the Current version of that and | 214 """Takes a path to Something.framework and the Current version of that and |
214 sets up all the symlinks.""" | 215 sets up all the symlinks.""" |
(...skipping 26 matching lines...) Expand all Loading... |
241 def _Relink(self, dest, link): | 242 def _Relink(self, dest, link): |
242 """Creates a symlink to |dest| named |link|. If |link| already exists, | 243 """Creates a symlink to |dest| named |link|. If |link| already exists, |
243 it is overwritten.""" | 244 it is overwritten.""" |
244 if os.path.lexists(link): | 245 if os.path.lexists(link): |
245 os.remove(link) | 246 os.remove(link) |
246 os.symlink(dest, link) | 247 os.symlink(dest, link) |
247 | 248 |
248 | 249 |
249 if __name__ == '__main__': | 250 if __name__ == '__main__': |
250 sys.exit(main(sys.argv[1:])) | 251 sys.exit(main(sys.argv[1:])) |
OLD | NEW |