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


Python SetupPy.find_packages方法代码示例

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


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

示例1: test_find_packages

# 需要导入模块: from pants.backend.python.tasks.setup_py import SetupPy [as 别名]
# 或者: from pants.backend.python.tasks.setup_py.SetupPy import find_packages [as 别名]
def test_find_packages():
    def assert_single_chroot(packages, namespace_packages, resources):
        with yield_chroot(packages, namespace_packages, resources) as chroot:
            p, n_p, r = SetupPy.find_packages(chroot)
            assert p == set(packages + namespace_packages)
            assert n_p == set(namespace_packages)
            assert r == dict((k, set(v)) for (k, v) in resources.items())

    # assert both packages and namespace packages work
    assert_single_chroot(["foo"], [], {})
    assert_single_chroot(["foo"], ["foo"], {})

    # assert resources work
    assert_single_chroot(["foo"], [], {"foo": ["blork.dat"]})

    resources = {"foo": ["f0", os.path.join("bar", "baz", "f1"), os.path.join("bar", "baz", "f2")]}
    assert_single_chroot(["foo"], [], resources)

    # assert that nearest-submodule is honored
    with yield_chroot(["foo", "foo.bar"], [], resources) as chroot:
        _, _, r = SetupPy.find_packages(chroot)
        assert r == {"foo": {"f0"}, "foo.bar": {os.path.join("baz", "f1"), os.path.join("baz", "f2")}}

    # assert that nearest submodule splits on module prefixes
    with yield_chroot(["foo", "foo.bar"], [], {"foo.bar1": ["f0"]}) as chroot:

        _, _, r = SetupPy.find_packages(chroot)
        assert r == {"foo": {"bar1/f0"}}
开发者ID:UnrememberMe,项目名称:pants,代码行数:30,代码来源:test_setup_py.py

示例2: test_find_packages

# 需要导入模块: from pants.backend.python.tasks.setup_py import SetupPy [as 别名]
# 或者: from pants.backend.python.tasks.setup_py.SetupPy import find_packages [as 别名]
def test_find_packages():
  def assert_single_chroot(packages, namespace_packages, resources):
    with yield_chroot(packages, namespace_packages, resources) as chroot:
      p, n_p, r = SetupPy.find_packages(chroot)
      assert p == set(packages + namespace_packages)
      assert n_p == set(namespace_packages)
      assert r == dict((k, set(v)) for (k, v) in resources.items())

  # assert both packages and namespace packages work
  assert_single_chroot(['foo'], [], {})
  assert_single_chroot(['foo'], ['foo'], {})

  # assert resources work
  assert_single_chroot(['foo'], [], {'foo': ['blork.dat']})

  resources = {
    'foo': [
      'f0',
      os.path.join('bar', 'baz', 'f1'),
      os.path.join('bar', 'baz', 'f2'),
    ]
  }
  assert_single_chroot(['foo'], [], resources)

  # assert that nearest-submodule is honored
  with yield_chroot(['foo', 'foo.bar'], [], resources) as chroot:
    _, _, r = SetupPy.find_packages(chroot)
    assert r == {
      'foo': {'f0'},
      'foo.bar': {os.path.join('baz', 'f1'), os.path.join('baz', 'f2')}
    }

  # assert that nearest submodule splits on module prefixes
  with yield_chroot(
      ['foo', 'foo.bar'],
      [],
      {'foo.bar1': ['f0']}) as chroot:

    _, _, r = SetupPy.find_packages(chroot)
    assert r == {'foo': {'bar1/f0'}}
开发者ID:Gabriel439,项目名称:pants,代码行数:42,代码来源:test_setup_py.py

示例3: assert_single_chroot

# 需要导入模块: from pants.backend.python.tasks.setup_py import SetupPy [as 别名]
# 或者: from pants.backend.python.tasks.setup_py.SetupPy import find_packages [as 别名]
 def assert_single_chroot(packages, namespace_packages, resources):
   with yield_chroot(packages, namespace_packages, resources) as chroot:
     p, n_p, r = SetupPy.find_packages(chroot)
     assert p == set(packages + namespace_packages)
     assert n_p == set(namespace_packages)
     assert r == dict((k, set(v)) for (k, v) in resources.items())
开发者ID:Gabriel439,项目名称:pants,代码行数:8,代码来源:test_setup_py.py


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