Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: build/mac/find_sdk.py

Issue 1134303012: Handle missing required arg in build/mac/find_sdk.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_pepper_44
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """Prints the lowest locally available SDK version greater than or equal to a 6 """Prints the lowest locally available SDK version greater than or equal to a
7 given minimum sdk version to standard output. 7 given minimum sdk version to standard output.
8 8
9 Usage: 9 Usage:
10 python find_sdk.py 10.6 # Ignores SDKs < 10.6 10 python find_sdk.py 10.6 # Ignores SDKs < 10.6
(...skipping 17 matching lines...) Expand all
28 parser = OptionParser() 28 parser = OptionParser()
29 parser.add_option("--verify", 29 parser.add_option("--verify",
30 action="store_true", dest="verify", default=False, 30 action="store_true", dest="verify", default=False,
31 help="return the sdk argument and warn if it doesn't exist") 31 help="return the sdk argument and warn if it doesn't exist")
32 parser.add_option("--sdk_path", 32 parser.add_option("--sdk_path",
33 action="store", type="string", dest="sdk_path", default="", 33 action="store", type="string", dest="sdk_path", default="",
34 help="user-specified SDK path; bypasses verification") 34 help="user-specified SDK path; bypasses verification")
35 parser.add_option("--print_sdk_path", 35 parser.add_option("--print_sdk_path",
36 action="store_true", dest="print_sdk_path", default=False, 36 action="store_true", dest="print_sdk_path", default=False,
37 help="Additionaly print the path the SDK (appears first).") 37 help="Additionaly print the path the SDK (appears first).")
38 (options, args) = parser.parse_args() 38 options, args = parser.parse_args()
39 if len(args) != 1:
40 parser.error('Please specify a minimum SDK version')
39 min_sdk_version = args[0] 41 min_sdk_version = args[0]
40 42
41 job = subprocess.Popen(['xcode-select', '-print-path'], 43 job = subprocess.Popen(['xcode-select', '-print-path'],
42 stdout=subprocess.PIPE, 44 stdout=subprocess.PIPE,
43 stderr=subprocess.STDOUT) 45 stderr=subprocess.STDOUT)
44 out, err = job.communicate() 46 out, err = job.communicate()
45 if job.returncode != 0: 47 if job.returncode != 0:
46 print >> sys.stderr, out 48 print >> sys.stderr, out
47 print >> sys.stderr, err 49 print >> sys.stderr, err
48 raise Exception(('Error %d running xcode-select, you might have to run ' 50 raise Exception(('Error %d running xcode-select, you might have to run '
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 print subprocess.check_output(['xcodebuild', '-version', '-sdk', 83 print subprocess.check_output(['xcodebuild', '-version', '-sdk',
82 'macosx' + best_sdk, 'Path']).strip() 84 'macosx' + best_sdk, 'Path']).strip()
83 85
84 return best_sdk 86 return best_sdk
85 87
86 88
87 if __name__ == '__main__': 89 if __name__ == '__main__':
88 if sys.platform != 'darwin': 90 if sys.platform != 'darwin':
89 raise Exception("This script only runs on Mac") 91 raise Exception("This script only runs on Mac")
90 print main() 92 print main()
93 sys.exit(0)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698