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

Side by Side Diff: mac/find_sdk.py

Issue 2898183004: fix: build on sierra
Patch Set: fix: build on sierra Created 3 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. If --developer_dir is passed, then 7 given minimum sdk version to standard output. If --developer_dir is passed, then
8 the script will use the Xcode toolchain located at DEVELOPER_DIR. 8 the script will use the Xcode toolchain located at DEVELOPER_DIR.
9 9
10 Usage: 10 Usage:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 job = subprocess.Popen(['xcode-select', '-print-path'], 47 job = subprocess.Popen(['xcode-select', '-print-path'],
48 stdout=subprocess.PIPE, 48 stdout=subprocess.PIPE,
49 stderr=subprocess.STDOUT) 49 stderr=subprocess.STDOUT)
50 out, err = job.communicate() 50 out, err = job.communicate()
51 if job.returncode != 0: 51 if job.returncode != 0:
52 print >> sys.stderr, out 52 print >> sys.stderr, out
53 print >> sys.stderr, err 53 print >> sys.stderr, err
54 raise Exception('Error %d running xcode-select' % job.returncode) 54 raise Exception('Error %d running xcode-select' % job.returncode)
55 sdk_dir = os.path.join( 55 sdk_dir = os.path.join(
56 out.rstrip(), 'Platforms/MacOSX.platform/Developer/SDKs') 56 out.rstrip(), 'SDKs')
57 sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)] 57 sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
58 sdks = [s[0] for s in sdks if s] # [['10.5'], ['10.6']] => ['10.5', '10.6'] 58 sdks = [s[0] for s in sdks if s] # [['10.5'], ['10.6']] => ['10.5', '10.6']
59 sdks = [s for s in sdks # ['10.5', '10.6'] => ['10.6'] 59 sdks = [s for s in sdks # ['10.5', '10.6'] => ['10.6']
60 if parse_version(s) >= parse_version(min_sdk_version)] 60 if parse_version(s) >= parse_version(min_sdk_version)]
61 if not sdks: 61 if not sdks:
62 raise Exception('No %s+ SDK found' % min_sdk_version) 62 raise Exception('No %s+ SDK found' % min_sdk_version)
63 best_sdk = sorted(sdks, key=parse_version)[0] 63 best_sdk = sorted(sdks, key=parse_version)[0]
64 64
65 if options.verify and best_sdk != min_sdk_version and not options.sdk_path: 65 if options.verify and best_sdk != min_sdk_version and not options.sdk_path:
66 print >> sys.stderr, '' 66 print >> sys.stderr, ''
(...skipping 14 matching lines...) Expand all
81 ['xcrun', '-sdk', 'macosx' + best_sdk, '--show-sdk-path']).strip() 81 ['xcrun', '-sdk', 'macosx' + best_sdk, '--show-sdk-path']).strip()
82 82
83 return best_sdk 83 return best_sdk
84 84
85 85
86 if __name__ == '__main__': 86 if __name__ == '__main__':
87 if sys.platform != 'darwin': 87 if sys.platform != 'darwin':
88 raise Exception("This script only runs on Mac") 88 raise Exception("This script only runs on Mac")
89 print main() 89 print main()
90 sys.exit(0) 90 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