[lit/libcxx] Fix a remaining reference to lit.util.capture() in custom libcxx/Darwin code.
Summary: This reference to lit.util.capture is functionally identical to subprocess.check_output, so this change switches to call the library routine directly. Reviewers: mzolotukhin, EricWF Reviewed By: mzolotukhin Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D34841 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306755 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -8,11 +8,11 @@
|
||||
#===----------------------------------------------------------------------===//
|
||||
|
||||
import importlib
|
||||
import lit.util # pylint: disable=import-error,no-name-in-module
|
||||
import locale
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
class DefaultTargetInfo(object):
|
||||
@@ -73,12 +73,13 @@ class DarwinLocalTI(DefaultTargetInfo):
|
||||
super(DarwinLocalTI, self).__init__(full_config)
|
||||
|
||||
def is_host_macosx(self):
|
||||
name = lit.util.capture(['sw_vers', '-productName']).strip()
|
||||
name = subprocess.check_output(['sw_vers', '-productName']).strip()
|
||||
return name == "Mac OS X"
|
||||
|
||||
def get_macosx_version(self):
|
||||
assert self.is_host_macosx()
|
||||
version = lit.util.capture(['sw_vers', '-productVersion']).strip()
|
||||
version = subprocess.check_output(
|
||||
['sw_vers', '-productVersion']).strip()
|
||||
version = re.sub(r'([0-9]+\.[0-9]+)(\..*)?', r'\1', version)
|
||||
return version
|
||||
|
||||
@@ -86,7 +87,7 @@ class DarwinLocalTI(DefaultTargetInfo):
|
||||
assert self.is_host_macosx()
|
||||
cmd = ['xcrun', '--sdk', name, '--show-sdk-path']
|
||||
try:
|
||||
out = lit.util.capture(cmd).strip()
|
||||
out = subprocess.check_output(cmd).strip()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
@@ -127,7 +128,7 @@ class DarwinLocalTI(DefaultTargetInfo):
|
||||
else:
|
||||
cmd = ['xcrun', '--show-sdk-path']
|
||||
try:
|
||||
out = lit.util.capture(cmd).strip()
|
||||
out = subprocess.check_output(cmd).strip()
|
||||
res = 0
|
||||
except OSError:
|
||||
res = -1
|
||||
|
||||
Reference in New Issue
Block a user