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


Python SetupPy.iter_entry_points方法代码示例

本文整理汇总了Python中pants.backend.python.tasks.setup_py.SetupPy.iter_entry_points方法的典型用法代码示例。如果您正苦于以下问题:Python SetupPy.iter_entry_points方法的具体用法?Python SetupPy.iter_entry_points怎么用?Python SetupPy.iter_entry_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pants.backend.python.tasks.setup_py.SetupPy的用法示例。


在下文中一共展示了SetupPy.iter_entry_points方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_binary_target_injected_into_reduced_dependencies

# 需要导入模块: from pants.backend.python.tasks.setup_py import SetupPy [as 别名]
# 或者: from pants.backend.python.tasks.setup_py.SetupPy import iter_entry_points [as 别名]
  def test_binary_target_injected_into_reduced_dependencies(self):
    foo_bin_dep = self.create_python_library(relpath='foo/dep', name='dep')

    foo_bin = self.create_python_binary(
      relpath='foo/bin',
      name='bin',
      entry_point='foo.bin:foo',
      dependencies=[
        'foo/dep',
      ]
    )

    foo = self.create_python_library(
      relpath='foo',
      name='foo',
      provides=dedent("""
      setup_py(
        name='foo',
        version='0.0.0'
      ).with_binaries(
        foo_binary='foo/bin'
      )
      """)
    )

    self.assertEqual(self.dependency_calculator.reduced_dependencies(foo),
                     OrderedSet([foo_bin, foo_bin_dep]))
    entry_points = dict(SetupPy.iter_entry_points(foo))
    self.assertEqual(entry_points, {'foo_binary': 'foo.bin:foo'})

    with self.run_execute(foo, recursive=False) as created:
      self.assertEqual([foo], list(created.keys()))

    with self.run_execute(foo, recursive=True) as created:
      self.assertEqual([foo], list(created.keys()))
开发者ID:cosmicexplorer,项目名称:pants,代码行数:37,代码来源:test_setup_py.py

示例2: test_binary_target_injected_into_reduced_dependencies_with_provider

# 需要导入模块: from pants.backend.python.tasks.setup_py import SetupPy [as 别名]
# 或者: from pants.backend.python.tasks.setup_py.SetupPy import iter_entry_points [as 别名]
  def test_binary_target_injected_into_reduced_dependencies_with_provider(self):
    bar_bin_dep = self.create_python_library(
      relpath='bar/dep',
      name='dep',
      provides=dedent("""
      setup_py(
        name='bar_bin_dep',
        version='0.0.0'
      )
      """)
    )

    bar_bin = self.create_python_binary(
      relpath='bar/bin',
      name='bin',
      entry_point='bar.bin:bar',
      dependencies=[
        'bar/dep'
      ],
    )

    bar = self.create_python_library(
      relpath='bar',
      name='bar',
      provides=dedent("""
      setup_py(
        name='bar',
        version='0.0.0'
      ).with_binaries(
        bar_binary='bar/bin'
      )
      """)
    )

    self.assertEqual(self.dependency_calculator.reduced_dependencies(bar),
                     OrderedSet([bar_bin, bar_bin_dep]))
    self.assert_requirements(bar, {'bar_bin_dep==0.0.0'})
    entry_points = dict(SetupPy.iter_entry_points(bar))
    self.assertEqual(entry_points, {'bar_binary': 'bar.bin:bar'})

    with self.run_execute(bar, recursive=False) as created:
      self.assertEqual([bar], list(created.keys()))

    with self.run_execute(bar, recursive=True) as created:
      self.assertEqual({bar_bin_dep, bar}, set(created.keys()))
开发者ID:cosmicexplorer,项目名称:pants,代码行数:47,代码来源:test_setup_py.py


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