本文整理汇总了Python中swift_build_support.toolchain.host_toolchain函数的典型用法代码示例。如果您正苦于以下问题:Python host_toolchain函数的具体用法?Python host_toolchain怎么用?Python host_toolchain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了host_toolchain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_found_executables_match
def test_found_executables_match(self):
# Test that the raw invocation of _first_common_executables
# either returns None or matching paths.
suffixes = ['', '-3.8', '-3.7', '-3.6']
toolchain = host_toolchain(suffixes=suffixes)
self.assertTrue(len(toolchain.tools) == 2)
exec_names = {'foo': 'a-tool-that-does-not-exist'}
toolchain = host_toolchain(tools=exec_names,
suffixes=suffixes)
self.assertIsNone(toolchain)
示例2: setUp
def setUp(self):
# Setup workspace
tmpdir1 = os.path.realpath(tempfile.mkdtemp())
tmpdir2 = os.path.realpath(tempfile.mkdtemp())
os.makedirs(os.path.join(tmpdir1, 'swift'))
self.workspace = Workspace(source_root=tmpdir1,
build_root=tmpdir2)
# Setup toolchain
self.toolchain = host_toolchain()
self.toolchain.cc = '/path/to/cc'
self.toolchain.cxx = '/path/to/cxx'
# Setup args
self.args = argparse.Namespace(
enable_tsan_runtime=False,
compiler_vendor='none',
swift_compiler_version=None,
clang_compiler_version=None,
swift_user_visible_version=None,
darwin_deployment_version_osx="10.9",
benchmark=False,
benchmark_num_onone_iterations=3,
benchmark_num_o_iterations=3,
enable_sil_ownership=False)
# Setup shell
shell.dry_run = True
self._orig_stdout = sys.stdout
self._orig_stderr = sys.stderr
self.stdout = StringIO()
self.stderr = StringIO()
sys.stdout = self.stdout
sys.stderr = self.stderr
示例3: setUp
def setUp(self):
# Setup workspace
tmpdir1 = os.path.realpath(tempfile.mkdtemp())
tmpdir2 = os.path.realpath(tempfile.mkdtemp())
os.makedirs(os.path.join(tmpdir1, "llvm"))
self.workspace = Workspace(source_root=tmpdir1, build_root=tmpdir2)
# Setup toolchain
self.toolchain = host_toolchain()
self.toolchain.cc = "/path/to/cc"
self.toolchain.cxx = "/path/to/cxx"
# Setup args
self.args = argparse.Namespace(
llvm_targets_to_build="X86;ARM;AArch64;PowerPC;SystemZ",
llvm_assertions="true",
compiler_vendor="none",
clang_compiler_version=None,
clang_user_visible_version=None,
darwin_deployment_version_osx="10.9",
)
# Setup shell
shell.dry_run = True
self._orig_stdout = sys.stdout
self._orig_stderr = sys.stderr
self.stdout = StringIO()
self.stderr = StringIO()
sys.stdout = self.stdout
sys.stderr = self.stderr
示例4: setUp
def setUp(self):
# Setup workspace
tmpdir1 = os.path.realpath(tempfile.mkdtemp())
tmpdir2 = os.path.realpath(tempfile.mkdtemp())
os.makedirs(os.path.join(tmpdir1, 'ninja'))
self.workspace = Workspace(source_root=tmpdir1,
build_root=tmpdir2)
# Setup toolchain
self.toolchain = host_toolchain()
self.toolchain.cc = '/path/to/cc'
self.toolchain.cxx = '/path/to/cxx'
# Setup args
self.args = argparse.Namespace(
build_ninja=True,
darwin_deployment_version_osx="10.9")
# Setup shell
shell.dry_run = True
self._orig_stdout = sys.stdout
self._orig_stderr = sys.stderr
self.stdout = StringIO()
self.stderr = StringIO()
sys.stdout = self.stdout
sys.stderr = self.stderr
示例5: test_tools_suffix_match
def test_tools_suffix_match(self):
tc = host_toolchain()
# CC and CXX must have consistent suffix
cc_suffix = get_suffix(tc.cc, 'clang')
cxx_suffix = get_suffix(tc.cxx, 'clang++')
self.assertEqual(cc_suffix, cxx_suffix)
示例6: which_ninja
def which_ninja(self, args):
toolchain = host_toolchain()
if toolchain.ninja is not None:
return '/path/to/installed/ninja'
# Maybe we'll build a ninja, maybe we wont.
# Fake it anyway for the tests.
return '/path/to/built/ninja'
示例7: cmake
def cmake(self, args):
"""Return new CMake object initialized with given args
"""
toolchain = host_toolchain()
toolchain.cc = args.host_cc
toolchain.cxx = args.host_cxx
if args.distcc:
toolchain.distcc = self.mock_distcc_path()
return CMake(args=args, toolchain=toolchain)
示例8: test_llvm_tools
def test_llvm_tools(self):
tc = host_toolchain()
self.assertTrue(
tc.llvm_profdata is None or
os.path.isabs(tc.llvm_profdata) and
os.path.basename(tc.llvm_profdata).startswith('llvm-profdata'))
self.assertTrue(
tc.llvm_cov is None or
os.path.isabs(tc.llvm_cov) and
os.path.basename(tc.llvm_cov).startswith('llvm-cov'))
示例9: cmake
def cmake(self, args):
"""Return new CMake object initialized with given args
"""
toolchain = host_toolchain()
toolchain.cc = args.host_cc
toolchain.cxx = args.host_cxx
if args.distcc:
toolchain.distcc = self.mock_distcc_path()
if args.build_ninja:
toolchain.ninja = '/path/to/built/ninja'
return CMake(args=args, toolchain=toolchain)
示例10: test_clang_tools
def test_clang_tools(self):
tc = host_toolchain()
self.assertIsNotNone(tc.cc)
self.assertIsNotNone(tc.cxx)
self.assertTrue(
os.path.isabs(tc.cc) and
os.path.basename(tc.cc).startswith('clang'))
self.assertTrue(
os.path.isabs(tc.cxx) and
os.path.basename(tc.cxx).startswith('clang++'))
示例11: test_can_find_llvm_cov
def test_can_find_llvm_cov(self):
suffixes = ['', '-3.8', '-3.7', '-3.6']
exec_names = {'llvm_cov': 'llvm-cov'}
toolchain = host_toolchain(tools=exec_names, suffixes=suffixes)
# must have clang, clang++, and llvm-cov
self.assertTrue(len(toolchain.tools) == 3)
try:
toolchain.llvm_cov
except AttributeError:
self.fail("toolchain does not have llvm_cov")
示例12: test_find_tool
def test_find_tool(self):
tc = host_toolchain()
# Toolchain.find_tool(path) can find arbitrary tool in PATH
sh = tc.find_tool('sh')
self.assertTrue(sh is not None and
os.path.isabs(sh) and
os.path.basename(sh) == 'sh')
tar = tc.find_tool('tar')
self.assertTrue(tar is not None and
os.path.isabs(tar) and
os.path.basename(tar) == 'tar')
示例13: test_misc_tools
def test_misc_tools(self):
tc = host_toolchain()
# CMake
self.assertIsNotNone(tc.cmake)
self.assertTrue(
os.path.basename(tc.cmake).startswith('cmake'))
# Ninja
self.assertTrue(tc.ninja is None or
os.path.basename(tc.ninja) == 'ninja' or
os.path.basename(tc.ninja) == 'ninja-build')
# distcc
self.assertTrue(tc.distcc is None or
os.path.basename(tc.distcc) == 'distcc')
# pump
self.assertTrue(tc.distcc_pump is None or
os.path.basename(tc.distcc_pump) == 'pump' or
os.path.basename(tc.distcc_pump) == 'distcc-pump')
示例14: test_tools_llvm_suffix
def test_tools_llvm_suffix(self):
tc = host_toolchain()
cov_suffix = None
profdata_suffix = None
if tc.llvm_cov:
cov_suffix = get_suffix(tc.llvm_cov, 'llvm-cov')
if tc.llvm_profdata:
profdata_suffix = get_suffix(tc.llvm_profdata, 'llvm-profdata')
if profdata_suffix is not None and cov_suffix is not None:
self.assertEqual(profdata_suffix, cov_suffix)
# If we have suffixed clang, llvm tools must have the same suffix.
cc_suffix = get_suffix(tc.cc, 'clang')
if cc_suffix != '':
if cov_suffix is not None:
self.assertEqual(cc_suffix, cov_suffix)
if profdata_suffix is not None:
self.assertEqual(cc_suffix, profdata_suffix)
示例15: noqa
import logging
import os
import pipes
import sys
from multiprocessing import Process
# Allow importing swift_build_support.
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..',
'swift_build_support'))
from swift_build_support import shell # noqa (E402)
from swift_build_support.toolchain import host_toolchain # noqa (E402)
toolchain = host_toolchain()
LLVM_PROFDATA_PATH = toolchain.llvm_profdata
_profdata_help = shell.capture([LLVM_PROFDATA_PATH, 'merge', '-help'],
echo=False)
LLVM_PROFDATA_SUPPORTS_SPARSE = 'sparse' in _profdata_help
class ProfdataMergerProcess(Process):
def __init__(self, config, file_queue):
super(ProfdataMergerProcess, self).__init__()
self.config = config
self.file_queue = file_queue
self.filename_buffer = []
self.profdata_path = os.path.join(config.tmp_dir,
"%s.profdata" % self.name)
self.profdata_tmp_path = self.profdata_path + ".copy"