本文整理汇总了Python中pants.base.build_graph.BuildGraph.dependencies_of方法的典型用法代码示例。如果您正苦于以下问题:Python BuildGraph.dependencies_of方法的具体用法?Python BuildGraph.dependencies_of怎么用?Python BuildGraph.dependencies_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pants.base.build_graph.BuildGraph
的用法示例。
在下文中一共展示了BuildGraph.dependencies_of方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_transitive_closure_spec
# 需要导入模块: from pants.base.build_graph import BuildGraph [as 别名]
# 或者: from pants.base.build_graph.BuildGraph import dependencies_of [as 别名]
def test_transitive_closure_spec(self):
with self.workspace('./BUILD', 'a/BUILD', 'a/b/BUILD') as root_dir:
with open(os.path.join(root_dir, './BUILD'), 'w') as build:
build.write(dedent('''
fake(name="foo",
dependencies=[
'a',
])
'''))
with open(os.path.join(root_dir, 'a/BUILD'), 'w') as build:
build.write(dedent('''
fake(name="a",
dependencies=[
'a/b:bat',
])
'''))
with open(os.path.join(root_dir, 'a/b/BUILD'), 'w') as build:
build.write(dedent('''
fake(name="bat")
'''))
build_configuration = BuildConfiguration()
build_configuration.register_target_alias('fake', Target)
parser = BuildFileParser(build_configuration, root_dir=root_dir)
build_graph = BuildGraph(self.address_mapper)
parser.inject_spec_closure_into_build_graph(':foo', build_graph)
self.assertEqual(len(build_graph.dependencies_of(SyntheticAddress.parse(':foo'))), 1)
示例2: test_transitive_closure_spec
# 需要导入模块: from pants.base.build_graph import BuildGraph [as 别名]
# 或者: from pants.base.build_graph.BuildGraph import dependencies_of [as 别名]
def test_transitive_closure_spec(self):
class FakeTarget(Target):
def __init__(self, *args, **kwargs):
super(FakeTarget, self).__init__(*args, payload=None, **kwargs)
with self.workspace('./BUILD', 'a/BUILD', 'a/b/BUILD') as root_dir:
with open(os.path.join(root_dir, './BUILD'), 'w') as build:
build.write(dedent('''
fake(name="foo",
dependencies=[
'a',
])
'''))
with open(os.path.join(root_dir, 'a/BUILD'), 'w') as build:
build.write(dedent('''
fake(name="a",
dependencies=[
'a/b:bat',
])
'''))
with open(os.path.join(root_dir, 'a/b/BUILD'), 'w') as build:
build.write(dedent('''
fake(name="bat")
'''))
parser = BuildFileParser(root_dir=root_dir,
exposed_objects={},
path_relative_utils={},
target_alias_map={'fake': FakeTarget})
build_graph = BuildGraph()
parser.inject_spec_closure_into_build_graph(':foo', build_graph)
self.assertEqual(len(build_graph.dependencies_of(SyntheticAddress(':foo'))), 1)