| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 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 |
| 4 # BSD-style license that can be found in the LICENSE file. |
| 5 |
| 6 import re |
| 7 import subprocess |
| 8 import sys |
| 9 |
| 10 def main(): |
| 11 job = subprocess.Popen(['xcodebuild', '-version'], |
| 12 stdout=subprocess.PIPE, |
| 13 stderr=subprocess.STDOUT) |
| 14 stdout, stderr = job.communicate() |
| 15 if job.returncode != 0: |
| 16 print >>sys.stderr, stdout |
| 17 print >>sys.stderr, stderr |
| 18 raise Exception('Error %d running xcodebuild!' % job.returncode) |
| 19 matches = re.findall('^Xcode (\d+)\.(\d+)\.(\d+)$', stdout, re.MULTILINE) |
| 20 if len(matches) > 0: |
| 21 major = int(matches[0][0]) |
| 22 minor = int(matches[0][1]) |
| 23 |
| 24 if major >= 4: |
| 25 return 'com.apple.compilers.llvmgcc42' |
| 26 elif major == 3 and minor >= 1: |
| 27 return '4.2' |
| 28 else: |
| 29 raise Exception('Unknown XCode Version "%s"' % version_match) |
| 30 else: |
| 31 raise Exception('Could not parse output of xcodebuild "%s"' % stdout) |
| 32 |
| 33 if __name__ == '__main__': |
| 34 if sys.platform != 'darwin': |
| 35 raise Exception("This script only runs on Mac") |
| 36 print main() |
| OLD | NEW |