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 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 | 25 |
26 def main(): | 26 def main(): |
27 parser = OptionParser() | 27 parser = OptionParser() |
28 parser.add_option("--verify", | 28 parser.add_option("--verify", |
29 action="store_true", dest="verify", default=False, | 29 action="store_true", dest="verify", default=False, |
30 help="return the sdk argument and warn if it doesn't exist") | 30 help="return the sdk argument and warn if it doesn't exist") |
31 parser.add_option("--sdk_path", | 31 parser.add_option("--sdk_path", |
32 action="store", type="string", dest="sdk_path", default="", | 32 action="store", type="string", dest="sdk_path", default="", |
33 help="user-specified SDK path; bypasses verification") | 33 help="user-specified SDK path; bypasses verification") |
34 parser.add_option("--print_sdk_path", | |
35 action="store_true", dest="print_sdk_path", default=False, | |
36 help="Additionaly print the path the SDK (appears first).") | |
34 (options, args) = parser.parse_args() | 37 (options, args) = parser.parse_args() |
35 min_sdk_version = args[0] | 38 min_sdk_version = args[0] |
36 | 39 |
37 job = subprocess.Popen(['xcode-select', '-print-path'], | 40 job = subprocess.Popen(['xcode-select', '-print-path'], |
38 stdout=subprocess.PIPE, | 41 stdout=subprocess.PIPE, |
39 stderr=subprocess.STDOUT) | 42 stderr=subprocess.STDOUT) |
40 out, err = job.communicate() | 43 out, err = job.communicate() |
41 if job.returncode != 0: | 44 if job.returncode != 0: |
42 print >>sys.stderr, out | 45 print >>sys.stderr, out |
43 print >>sys.stderr, err | 46 print >>sys.stderr, err |
(...skipping 22 matching lines...) Expand all Loading... | |
66 print >>sys.stderr, \ | 69 print >>sys.stderr, \ |
67 '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.' \ |
68 % min_sdk_version | 71 % min_sdk_version |
69 print >>sys.stderr, \ | 72 print >>sys.stderr, \ |
70 '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.' |
71 print >>sys.stderr, '' | 74 print >>sys.stderr, '' |
72 print >>sys.stderr, ' ^^^^^^^' | 75 print >>sys.stderr, ' ^^^^^^^' |
73 print >>sys.stderr, '' | 76 print >>sys.stderr, '' |
74 return min_sdk_version | 77 return min_sdk_version |
75 | 78 |
79 if options.print_sdk_path: | |
80 print subprocess.check_output(['xcodebuild', '-version', '-sdk', | |
Nico
2014/01/16 22:52:58
check_output is 2.7+…I guess that's fine these day
| |
81 'macosx' + best_sdk, 'Path']).strip() | |
82 | |
76 return best_sdk | 83 return best_sdk |
77 | 84 |
78 | 85 |
79 if __name__ == '__main__': | 86 if __name__ == '__main__': |
80 if sys.platform != 'darwin': | 87 if sys.platform != 'darwin': |
81 raise Exception("This script only runs on Mac") | 88 raise Exception("This script only runs on Mac") |
82 print main() | 89 print main() |
OLD | NEW |