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

Side by Side Diff: tools/gyp/find_mac_gcc_version.py

Issue 1343393004: SDK gyp: support Xcode V7 (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: cl feedback Created 5 years, 2 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) 2013, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 import re 6 import re
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 9
10 def main(): 10 def main():
11 job = subprocess.Popen(['xcodebuild', '-version'], 11 job = subprocess.Popen(['xcodebuild', '-version'],
12 stdout=subprocess.PIPE, 12 stdout=subprocess.PIPE,
13 stderr=subprocess.STDOUT) 13 stderr=subprocess.STDOUT)
14 stdout, stderr = job.communicate() 14 stdout, stderr = job.communicate()
15 if job.returncode != 0: 15 if job.returncode != 0:
16 print >>sys.stderr, stdout 16 print >>sys.stderr, stdout
17 print >>sys.stderr, stderr 17 print >>sys.stderr, stderr
18 raise Exception('Error %d running xcodebuild!' % job.returncode) 18 raise Exception('Error %d running xcodebuild!' % job.returncode)
19 matches = re.findall('^Xcode (\d+)\.(\d+)(\.(\d+))?$', stdout, re.MULTILINE) 19 matches = re.findall('^Xcode (\d+)\.(\d+)(\.(\d+))?$', stdout, re.MULTILINE)
20 if len(matches) > 0: 20 if len(matches) > 0:
21 major = int(matches[0][0]) 21 major = int(matches[0][0])
22 minor = int(matches[0][1]) 22 minor = int(matches[0][1])
23 23
24 if major == 3 and minor >= 1: 24 if major == 3 and minor >= 1:
25 return '4.2' 25 return '4.2'
26 elif major == 4 and minor < 5: 26 elif major == 4 and minor < 5:
27 return 'com.apple.compilers.llvmgcc42' 27 return 'com.apple.compilers.llvmgcc42'
28 elif (major == 4 and minor >= 5) or major == 5 or major == 6: 28 elif (major == 4 and minor >= 5) or major => 5:
Paul Berry 2015/09/22 12:38:47 This is a syntax error. I think you mean ">=" ins
29 # XCode seems to select the specific clang version automatically 29 # XCode seems to select the specific clang version automatically
30 return 'com.apple.compilers.llvm.clang.1_0' 30 return 'com.apple.compilers.llvm.clang.1_0'
31 else: 31 else:
32 raise Exception('Unknown XCode Version "%s"' % stdout) 32 raise Exception('Unknown XCode Version "%s"' % stdout)
33 else: 33 else:
34 raise Exception('Could not parse output of xcodebuild "%s"' % stdout) 34 raise Exception('Could not parse output of xcodebuild "%s"' % stdout)
35 35
36 if __name__ == '__main__': 36 if __name__ == '__main__':
37 if sys.platform != 'darwin': 37 if sys.platform != 'darwin':
38 #raise Exception("This script only runs on Mac") 38 #raise Exception("This script only runs on Mac")
39 # If we aren't on Mac, print out a dummy version string; it won't be used. 39 # If we aren't on Mac, print out a dummy version string; it won't be used.
40 print 'X.X' 40 print 'X.X'
41 else: 41 else:
42 print main() 42 print main()
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