OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. 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 import os | 6 import os |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 'This build requires the %s SDK, but it was not found on your system.' \ | 70 'This build requires the %s SDK, but it was not found on your system.' \ |
71 % min_sdk_version | 71 % min_sdk_version |
72 print >>sys.stderr, \ | 72 print >>sys.stderr, \ |
73 'Either install it, or explicitly set mac_sdk in your GYP_DEFINES.' | 73 'Either install it, or explicitly set mac_sdk in your GYP_DEFINES.' |
74 print >>sys.stderr, '' | 74 print >>sys.stderr, '' |
75 print >>sys.stderr, ' ^^^^^^^' | 75 print >>sys.stderr, ' ^^^^^^^' |
76 print >>sys.stderr, '' | 76 print >>sys.stderr, '' |
77 return min_sdk_version | 77 return min_sdk_version |
78 | 78 |
79 if options.print_sdk_path: | 79 if options.print_sdk_path: |
80 print subprocess.check_output(['xcodebuild', '-version', '-sdk', | 80 job = subprocess.Popen(['xcodebuild', '-version', '-sdk', |
81 'macosx' + best_sdk, 'Path']).strip() | 81 'macosx' + best_sdk, 'Path'], |
| 82 stdout=subprocess.PIPE, |
| 83 stderr=subprocess.STDOUT) |
| 84 out, err = job.communicate() |
| 85 if job.returncode != 0: |
| 86 print >>sys.stderr, out |
| 87 print >>sys.stderr, err |
| 88 raise Exception('No %s SDK found' % best_sdk) |
| 89 print out.strip() |
82 | 90 |
83 return best_sdk | 91 return best_sdk |
84 | 92 |
85 | 93 |
86 if __name__ == '__main__': | 94 if __name__ == '__main__': |
87 if sys.platform != 'darwin': | 95 if sys.platform != 'darwin': |
88 raise Exception("This script only runs on Mac") | 96 raise Exception("This script only runs on Mac") |
89 print main() | 97 print main() |
OLD | NEW |