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

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

Issue 1840323002: Add mac toolchain script support to find_sdk script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 22 matching lines...) Expand all
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: 39 if len(args) != 1:
40 parser.error('Please specify a minimum SDK version') 40 parser.error('Please specify a minimum SDK version')
41 min_sdk_version = args[0] 41 min_sdk_version = args[0]
42 42
43 # Try using the toolchain in mac_files.
44 sys.path.append(os.path.dirname(os.path.dirname(__file__)))
45 import mac_toolchain
erikchen 2016/03/30 17:39:55 I've seen python files in our code base that would
justincohen 2016/03/30 21:14:26 Done.
46 mac_toolchain_dir = mac_toolchain.GetToolchainDirectory()
47 if mac_toolchain_dir:
48 os.environ['DEVELOPER_DIR'] = mac_toolchain_dir
erikchen 2016/03/30 17:39:55 2 space indent? Given that this logic is also pre
justincohen 2016/03/30 21:14:26 Done.
49
43 job = subprocess.Popen(['xcode-select', '-print-path'], 50 job = subprocess.Popen(['xcode-select', '-print-path'],
44 stdout=subprocess.PIPE, 51 stdout=subprocess.PIPE,
45 stderr=subprocess.STDOUT) 52 stderr=subprocess.STDOUT)
46 out, err = job.communicate() 53 out, err = job.communicate()
47 if job.returncode != 0: 54 if job.returncode != 0:
48 print >> sys.stderr, out 55 print >> sys.stderr, out
49 print >> sys.stderr, err 56 print >> sys.stderr, err
50 raise Exception(('Error %d running xcode-select, you might have to run ' 57 raise Exception(('Error %d running xcode-select, you might have to run '
51 '|sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer| ' 58 '|sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer| '
52 'if you are using Xcode 4.') % job.returncode) 59 'if you are using Xcode 4.') % job.returncode)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 'macosx' + best_sdk, 'Path']).strip() 91 'macosx' + best_sdk, 'Path']).strip()
85 92
86 return best_sdk 93 return best_sdk
87 94
88 95
89 if __name__ == '__main__': 96 if __name__ == '__main__':
90 if sys.platform != 'darwin': 97 if sys.platform != 'darwin':
91 raise Exception("This script only runs on Mac") 98 raise Exception("This script only runs on Mac")
92 print main() 99 print main()
93 sys.exit(0) 100 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