当前位置: 首页>>代码示例>>Python>>正文


Python BuildGraph.dependencies_of方法代码示例

本文整理汇总了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)
开发者ID:ankurgarg1986,项目名称:pants,代码行数:31,代码来源:test_build_graph.py

示例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)
开发者ID:ejconlon,项目名称:pants,代码行数:37,代码来源:test_build_graph.py


注:本文中的pants.base.build_graph.BuildGraph.dependencies_of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。