Index: build/mac/find_sdk.py |
diff --git a/runtime/tools/gyp/find_mac_sdk.py b/build/mac/find_sdk.py |
similarity index 77% |
copy from runtime/tools/gyp/find_mac_sdk.py |
copy to build/mac/find_sdk.py |
index baf627981e6ab59df8ab8dbfad6f0f0c8894f063..0534766e8077e763521882156c45aef95ae6628b 100755 |
--- a/runtime/tools/gyp/find_mac_sdk.py |
+++ b/build/mac/find_sdk.py |
@@ -3,24 +3,18 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
-# for details. All rights reserved. Use of this source code is governed by a |
-# BSD-style license that can be found in the LICENSE file. |
+"""Prints the lowest locally available SDK version greater than or equal to a |
+given minimum sdk version to standard output. |
-# This file is a copy of Chromium's src/build/mac/find_sdk.py. |
-# Revision 180337. |
+Usage: |
+ python find_sdk.py 10.6 # Ignores SDKs < 10.6 |
+""" |
import os |
import re |
import subprocess |
import sys |
-"""Prints the lowest locally available SDK version greater than or equal to a |
-given minimum sdk version to standard output. |
- |
-Usage: |
- python find_sdk.py 10.6 # Ignores SDKs < 10.6 |
-""" |
from optparse import OptionParser |
@@ -38,6 +32,9 @@ def main(): |
parser.add_option("--sdk_path", |
action="store", type="string", dest="sdk_path", default="", |
help="user-specified SDK path; bypasses verification") |
+ parser.add_option("--print_sdk_path", |
+ action="store_true", dest="print_sdk_path", default=False, |
+ help="Additionaly print the path the SDK (appears first).") |
(options, args) = parser.parse_args() |
min_sdk_version = args[0] |
@@ -46,8 +43,8 @@ def main(): |
stderr=subprocess.STDOUT) |
out, err = job.communicate() |
if job.returncode != 0: |
- print >>sys.stderr, out |
- print >>sys.stderr, err |
+ print >> sys.stderr, out |
+ print >> sys.stderr, err |
raise Exception(('Error %d running xcode-select, you might have to run ' |
'|sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer| ' |
'if you are using Xcode 4.') % job.returncode) |
@@ -67,19 +64,23 @@ def main(): |
best_sdk = sorted(sdks, key=parse_version)[0] |
if options.verify and best_sdk != min_sdk_version and not options.sdk_path: |
- print >>sys.stderr, '' |
- print >>sys.stderr, ' vvvvvvv' |
- print >>sys.stderr, '' |
- print >>sys.stderr, \ |
+ print >> sys.stderr, '' |
+ print >> sys.stderr, ' vvvvvvv' |
+ print >> sys.stderr, '' |
+ print >> sys.stderr, \ |
'This build requires the %s SDK, but it was not found on your system.' \ |
% min_sdk_version |
- print >>sys.stderr, \ |
+ print >> sys.stderr, \ |
'Either install it, or explicitly set mac_sdk in your GYP_DEFINES.' |
- print >>sys.stderr, '' |
- print >>sys.stderr, ' ^^^^^^^' |
- print >>sys.stderr, '' |
+ print >> sys.stderr, '' |
+ print >> sys.stderr, ' ^^^^^^^' |
+ print >> sys.stderr, '' |
return min_sdk_version |
+ if options.print_sdk_path: |
+ print subprocess.check_output(['xcodebuild', '-version', '-sdk', |
+ 'macosx' + best_sdk, 'Path']).strip() |
+ |
return best_sdk |