| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os |
| 5 import subprocess | 6 import subprocess |
| 6 import sys | 7 import sys |
| 7 | 8 |
| 8 # This script returns the path to the SDK of the given type. Pass the type of | 9 # This script prints information about the build system, the operating |
| 9 # SDK you want, which is typically "iphone" or "iphonesimulator". | 10 # system and the iOS SDK (depending on the platform "iphonesimulator" |
| 11 # or "iphoneos" generally). |
| 10 # | 12 # |
| 11 # In the GYP build, this is done inside GYP itself based on the SDKROOT | 13 # In the GYP build, this is done inside GYP itself based on the SDKROOT |
| 12 # variable. | 14 # variable. |
| 13 | 15 |
| 14 if len(sys.argv) != 2: | 16 def FormatVersion(version): |
| 15 print "Takes one arg (SDK to find)" | 17 """Converts Xcode version to a format required for Info.plist.""" |
| 16 sys.exit(1) | 18 version = version.replace('.', '') |
| 19 version = version + '0' * (3 - len(version)) |
| 20 return version.zfill(4) |
| 17 | 21 |
| 18 print subprocess.check_output(['xcodebuild', '-version', '-sdk', | 22 |
| 19 sys.argv[1], 'Path']).strip() | 23 def PrintXcodeVersion(): |
| 24 """Prints the Xcode version and build number.""" |
| 25 lines = subprocess.check_output(['xcodebuild', '-version']).splitlines() |
| 26 print FormatVersion(lines[0].split()[-1]) |
| 27 print lines[-1].split()[-1] |
| 28 |
| 29 |
| 30 def PrintMachineOSBuild(): |
| 31 """Prints OS build number.""" |
| 32 subprocess.check_call(['sw_vers', '-buildVersion']) |
| 33 |
| 34 |
| 35 def PrintSDKPathAndVersion(platform): |
| 36 """Prints the SDK path and version for |platform|.""" |
| 37 subprocess.check_call(['xcodebuild', '-version', '-sdk', |
| 38 platform, 'Path', 'SDKVersion']) |
| 39 |
| 40 |
| 41 if __name__ == '__main__': |
| 42 if len(sys.argv) != 2: |
| 43 sys.stderr.write( |
| 44 'usage: %s [iphoneos|iphonesimulator]\n' % |
| 45 os.path.basename(sys.argv[0])) |
| 46 sys.exit(1) |
| 47 |
| 48 PrintSDKPathAndVersion(sys.argv[1]) |
| 49 PrintXcodeVersion() |
| 50 PrintMachineOSBuild() |
| OLD | NEW |