Fix macOS version detection to also allow missing 3rd part of the version number.

llvm-svn: 298008
This commit is contained in:
Kuba Mracek 2017-03-16 22:35:34 +00:00
parent 1875334f32
commit 720883520d
1 changed files with 4 additions and 1 deletions

View File

@ -126,10 +126,11 @@ if config.can_symbolize:
lit.util.usePlatformSdkOnDarwin(config, lit_config)
if config.host_os == 'Darwin':
osx_version = (10, 0, 0)
try:
osx_version = subprocess.check_output(["sw_vers", "-productVersion"])
osx_version = tuple(int(x) for x in osx_version.split('.'))
config.darwin_osx_version = osx_version
if len(osx_version) == 2: osx_version = (osx_version[0], osx_version[1], 0)
if osx_version >= (10, 11):
config.available_features.add('osx-autointerception')
config.available_features.add('osx-ld64-live_support')
@ -142,6 +143,8 @@ if config.host_os == 'Darwin':
except:
pass
config.darwin_osx_version = osx_version
# Detect x86_64h
try:
output = subprocess.check_output(["sysctl", "hw.cpusubtype"])