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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 # Ref: | 227 # Ref: |
228 # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c | 228 # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c |
229 # The problem with this flag is that it resets the file mtime on the file to | 229 # The problem with this flag is that it resets the file mtime on the file to |
230 # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. | 230 # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. |
231 env['ZERO_AR_DATE'] = '1' | 231 env['ZERO_AR_DATE'] = '1' |
232 libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) | 232 libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) |
233 _, err = libtoolout.communicate() | 233 _, err = libtoolout.communicate() |
234 for line in err.splitlines(): | 234 for line in err.splitlines(): |
235 if not libtool_re.match(line) and not libtool_re5.match(line): | 235 if not libtool_re.match(line) and not libtool_re5.match(line): |
236 print >>sys.stderr, line | 236 print >>sys.stderr, line |
237 # Unconditionally touch any file .a file on the command line if present if | 237 # Unconditionally touch the output .a file on the command line if present |
238 # succeeded. A bit hacky. | 238 # and the command succeeded. A bit hacky. |
239 if not libtoolout.returncode: | 239 if not libtoolout.returncode: |
240 archives = [ | 240 for i in range(len(cmd_list) - 1): |
241 cmd for cmd in cmd_list if cmd.endswith('.a') and os.path.isfile(cmd) | 241 if cmd_list[i] == "-o" and cmd_list[i+1].endswith('.a'): |
242 ] | 242 os.utime(cmd_list[i+1], None) |
243 if len(archives) == 1: | 243 break |
244 os.utime(archives[0], None) | |
245 return libtoolout.returncode | 244 return libtoolout.returncode |
246 | 245 |
247 def ExecPackageFramework(self, framework, version): | 246 def ExecPackageFramework(self, framework, version): |
248 """Takes a path to Something.framework and the Current version of that and | 247 """Takes a path to Something.framework and the Current version of that and |
249 sets up all the symlinks.""" | 248 sets up all the symlinks.""" |
250 # Find the name of the binary based on the part before the ".framework". | 249 # Find the name of the binary based on the part before the ".framework". |
251 binary = os.path.basename(framework).split('.')[0] | 250 binary = os.path.basename(framework).split('.')[0] |
252 | 251 |
253 CURRENT = 'Current' | 252 CURRENT = 'Current' |
254 RESOURCES = 'Resources' | 253 RESOURCES = 'Resources' |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 data = data.replace('$(%s)' % key, value) | 591 data = data.replace('$(%s)' % key, value) |
593 return data | 592 return data |
594 if isinstance(data, list): | 593 if isinstance(data, list): |
595 return [self._ExpandVariables(v, substitutions) for v in data] | 594 return [self._ExpandVariables(v, substitutions) for v in data] |
596 if isinstance(data, dict): | 595 if isinstance(data, dict): |
597 return {k: self._ExpandVariables(data[k], substitutions) for k in data} | 596 return {k: self._ExpandVariables(data[k], substitutions) for k in data} |
598 return data | 597 return data |
599 | 598 |
600 if __name__ == '__main__': | 599 if __name__ == '__main__': |
601 sys.exit(main(sys.argv[1:])) | 600 sys.exit(main(sys.argv[1:])) |
OLD | NEW |