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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 def ExecFlock(self, lockfile, *cmd_list): | 221 def ExecFlock(self, lockfile, *cmd_list): |
222 """Emulates the most basic behavior of Linux's flock(1).""" | 222 """Emulates the most basic behavior of Linux's flock(1).""" |
223 # Rely on exception handling to report errors. | 223 # Rely on exception handling to report errors. |
224 fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) | 224 fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) |
225 fcntl.flock(fd, fcntl.LOCK_EX) | 225 fcntl.flock(fd, fcntl.LOCK_EX) |
226 return subprocess.call(cmd_list) | 226 return subprocess.call(cmd_list) |
227 | 227 |
228 def ExecFilterLibtool(self, *cmd_list): | 228 def ExecFilterLibtool(self, *cmd_list): |
229 """Calls libtool and filters out '/path/to/libtool: file: foo.o has no | 229 """Calls libtool and filters out '/path/to/libtool: file: foo.o has no |
230 symbols'.""" | 230 symbols'.""" |
231 libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') | 231 libtool_re = re.compile(r'^.*libtool: (?:for architecture: \S* )?' |
| 232 r'file: .* has no symbols$') |
232 libtool_re5 = re.compile( | 233 libtool_re5 = re.compile( |
233 r'^.*libtool: warning for library: ' + | 234 r'^.*libtool: warning for library: ' + |
234 r'.* the table of contents is empty ' + | 235 r'.* the table of contents is empty ' + |
235 r'\(no object file members in the library define global symbols\)$') | 236 r'\(no object file members in the library define global symbols\)$') |
236 env = os.environ.copy() | 237 env = os.environ.copy() |
237 # Ref: | 238 # Ref: |
238 # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c | 239 # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c |
239 # The problem with this flag is that it resets the file mtime on the file to | 240 # The problem with this flag is that it resets the file mtime on the file to |
240 # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. | 241 # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. |
241 env['ZERO_AR_DATE'] = '1' | 242 env['ZERO_AR_DATE'] = '1' |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 data = data.replace('$(%s)' % key, value) | 602 data = data.replace('$(%s)' % key, value) |
602 return data | 603 return data |
603 if isinstance(data, list): | 604 if isinstance(data, list): |
604 return [self._ExpandVariables(v, substitutions) for v in data] | 605 return [self._ExpandVariables(v, substitutions) for v in data] |
605 if isinstance(data, dict): | 606 if isinstance(data, dict): |
606 return {k: self._ExpandVariables(data[k], substitutions) for k in data} | 607 return {k: self._ExpandVariables(data[k], substitutions) for k in data} |
607 return data | 608 return data |
608 | 609 |
609 if __name__ == '__main__': | 610 if __name__ == '__main__': |
610 sys.exit(main(sys.argv[1:])) | 611 sys.exit(main(sys.argv[1:])) |
OLD | NEW |