本文整理匯總了Python中setuptools.find_namespace_packages方法的典型用法代碼示例。如果您正苦於以下問題:Python setuptools.find_namespace_packages方法的具體用法?Python setuptools.find_namespace_packages怎麽用?Python setuptools.find_namespace_packages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類setuptools
的用法示例。
在下文中一共展示了setuptools.find_namespace_packages方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _parse_packages
# 需要導入模塊: import setuptools [as 別名]
# 或者: from setuptools import find_namespace_packages [as 別名]
def _parse_packages(self, value):
"""Parses `packages` option value.
:param value:
:rtype: list
"""
find_directives = ['find:', 'find_namespace:']
trimmed_value = value.strip()
if trimmed_value not in find_directives:
return self._parse_list(value)
findns = trimmed_value == find_directives[1]
if findns and not PY3:
raise DistutilsOptionError(
'find_namespace: directive is unsupported on Python < 3.3')
# Read function arguments from a dedicated section.
find_kwargs = self.parse_section_packages__find(
self.sections.get('packages.find', {}))
if findns:
from setuptools import find_namespace_packages as find_packages
else:
from setuptools import find_packages
return find_packages(**find_kwargs)
示例2: _parse_packages
# 需要導入模塊: import setuptools [as 別名]
# 或者: from setuptools import find_namespace_packages [as 別名]
def _parse_packages(self, value):
"""Parses `packages` option value.
:param value:
:rtype: list
"""
find_directives = ['find:', 'find_namespace:']
trimmed_value = value.strip()
if not trimmed_value in find_directives:
return self._parse_list(value)
findns = trimmed_value == find_directives[1]
if findns and not PY3:
raise DistutilsOptionError('find_namespace: directive is unsupported on Python < 3.3')
# Read function arguments from a dedicated section.
find_kwargs = self.parse_section_packages__find(
self.sections.get('packages.find', {}))
if findns:
from setuptools import find_namespace_packages as find_packages
else:
from setuptools import find_packages
return find_packages(**find_kwargs)
示例3: test_pep420_ns_package
# 需要導入模塊: import setuptools [as 別名]
# 或者: from setuptools import find_namespace_packages [as 別名]
def test_pep420_ns_package(self):
packages = find_namespace_packages(
self.dist_dir, include=['pkg*'], exclude=['pkg.subpkg.assets'])
self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
示例4: test_pep420_ns_package_no_includes
# 需要導入模塊: import setuptools [as 別名]
# 或者: from setuptools import find_namespace_packages [as 別名]
def test_pep420_ns_package_no_includes(self):
packages = find_namespace_packages(
self.dist_dir, exclude=['pkg.subpkg.assets'])
self._assert_packages(
packages, ['docs', 'pkg', 'pkg.nspkg', 'pkg.subpkg'])
示例5: test_pep420_ns_package_no_includes_or_excludes
# 需要導入模塊: import setuptools [as 別名]
# 或者: from setuptools import find_namespace_packages [as 別名]
def test_pep420_ns_package_no_includes_or_excludes(self):
packages = find_namespace_packages(self.dist_dir)
expected = [
'docs', 'pkg', 'pkg.nspkg', 'pkg.subpkg', 'pkg.subpkg.assets']
self._assert_packages(packages, expected)
示例6: test_regular_package_with_nested_pep420_ns_packages
# 需要導入模塊: import setuptools [as 別名]
# 或者: from setuptools import find_namespace_packages [as 別名]
def test_regular_package_with_nested_pep420_ns_packages(self):
self._touch('__init__.py', self.pkg_dir)
packages = find_namespace_packages(
self.dist_dir, exclude=['docs', 'pkg.subpkg.assets'])
self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
示例7: test_pep420_ns_package_no_non_package_dirs
# 需要導入模塊: import setuptools [as 別名]
# 或者: from setuptools import find_namespace_packages [as 別名]
def test_pep420_ns_package_no_non_package_dirs(self):
shutil.rmtree(self.docs_dir)
shutil.rmtree(os.path.join(self.dist_dir, 'pkg/subpkg/assets'))
packages = find_namespace_packages(self.dist_dir)
self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])