本文整理汇总了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"}}
示例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'}}
示例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())