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 os |
6 import subprocess | 6 import subprocess |
7 import sys | 7 import sys |
8 | 8 |
9 # This script prints information about the build system, the operating | 9 # This script prints information about the build system, the operating |
10 # system and the iOS or Mac SDK (depending on the platform "iphonesimulator", | 10 # system and the iOS or Mac SDK (depending on the platform "iphonesimulator", |
(...skipping 15 matching lines...) Expand all Loading... | |
26 settings['xcode_version'] = FormatVersion(lines[0].split()[-1]) | 26 settings['xcode_version'] = FormatVersion(lines[0].split()[-1]) |
27 settings['xcode_build'] = lines[-1].split()[-1] | 27 settings['xcode_build'] = lines[-1].split()[-1] |
28 | 28 |
29 | 29 |
30 def FillMachineOSBuild(settings): | 30 def FillMachineOSBuild(settings): |
31 """Fills OS build number into |settings|.""" | 31 """Fills OS build number into |settings|.""" |
32 settings['machine_os_build'] = subprocess.check_output( | 32 settings['machine_os_build'] = subprocess.check_output( |
33 ['sw_vers', '-buildVersion']).strip() | 33 ['sw_vers', '-buildVersion']).strip() |
34 | 34 |
35 | 35 |
36 def FillSDKPathAndVersion(settings, platform): | 36 def FillSDKPathAndVersion(settings, platform, xcode_version): |
37 """Fills the SDK path and version for |platform| into |settings|.""" | 37 """Fills the SDK path and version for |platform| into |settings|.""" |
38 lines = subprocess.check_output(['xcodebuild', '-version', '-sdk', | 38 settings['sdk_path'] = subprocess.check_output([ |
39 platform, 'Path', 'SDKVersion', 'ProductBuildVersion']).splitlines() | 39 'xcrun', '-sdk', platform, '--show-sdk-path']).strip() |
40 settings['sdk_path'] = lines[0] | 40 settings['sdk_version'] = subprocess.check_output([ |
41 settings['sdk_version'] = lines[1] | 41 'xcrun', '-sdk', platform, '--show-sdk-version']).strip() |
42 settings['sdk_build'] = lines[2] | 42 if xcode_version >= '0720': |
Nico
2016/05/18 18:41:42
Maybe add an "TODO: unconditionally do this once a
| |
43 settings['sdk_build'] = subprocess.check_output([ | |
44 'xcrun', '-sdk', platform, '--show-sdk-build-version']).strip() | |
45 else: | |
46 settings['sdk_build'] = settings['sdk_version'] | |
43 | 47 |
44 | 48 |
45 if __name__ == '__main__': | 49 if __name__ == '__main__': |
46 if len(sys.argv) != 2: | 50 if len(sys.argv) != 2: |
47 sys.stderr.write( | 51 sys.stderr.write( |
48 'usage: %s [iphoneos|iphonesimulator|macosx]\n' % | 52 'usage: %s [iphoneos|iphonesimulator|macosx]\n' % |
49 os.path.basename(sys.argv[0])) | 53 os.path.basename(sys.argv[0])) |
50 sys.exit(1) | 54 sys.exit(1) |
51 | 55 |
52 settings = {} | 56 settings = {} |
53 FillSDKPathAndVersion(settings, sys.argv[1]) | |
54 FillMachineOSBuild(settings) | 57 FillMachineOSBuild(settings) |
55 FillXcodeVersion(settings) | 58 FillXcodeVersion(settings) |
59 FillSDKPathAndVersion(settings, sys.argv[1], settings['xcode_version']) | |
56 | 60 |
57 for key in sorted(settings): | 61 for key in sorted(settings): |
58 print '%s="%s"' % (key, settings[key]) | 62 print '%s="%s"' % (key, settings[key]) |
OLD | NEW |