本文整理汇总了Python中pkg_resources.UnknownExtra方法的典型用法代码示例。如果您正苦于以下问题:Python pkg_resources.UnknownExtra方法的具体用法?Python pkg_resources.UnknownExtra怎么用?Python pkg_resources.UnknownExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pkg_resources
的用法示例。
在下文中一共展示了pkg_resources.UnknownExtra方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDistroDependsOptions
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import UnknownExtra [as 别名]
def testDistroDependsOptions(self):
d = self.distRequires("""
Twisted>=1.5
[docgen]
ZConfig>=2.0
docutils>=0.3
[fastcgi]
fcgiapp>=0.1""")
self.checkRequires(d,"Twisted>=1.5")
self.checkRequires(
d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
)
self.checkRequires(
d,"Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"]
)
self.checkRequires(
d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
["docgen","fastcgi"]
)
self.checkRequires(
d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
["fastcgi", "docgen"]
)
self.assertRaises(pkg_resources.UnknownExtra, d.requires, ["foo"])
示例2: testDistroDependsOptions
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import UnknownExtra [as 别名]
def testDistroDependsOptions(self):
d = self.distRequires("""
Twisted>=1.5
[docgen]
ZConfig>=2.0
docutils>=0.3
[fastcgi]
fcgiapp>=0.1""")
self.checkRequires(d, "Twisted>=1.5")
self.checkRequires(
d, "Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
)
self.checkRequires(
d, "Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"]
)
self.checkRequires(
d, "Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
["docgen", "fastcgi"]
)
self.checkRequires(
d, "Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
["fastcgi", "docgen"]
)
with pytest.raises(pkg_resources.UnknownExtra):
d.requires(["foo"])
示例3: testDistroDependsOptions
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import UnknownExtra [as 别名]
def testDistroDependsOptions(self):
d = self.distRequires("""
Twisted>=1.5
[docgen]
ZConfig>=2.0
docutils>=0.3
[fastcgi]
fcgiapp>=0.1""")
self.checkRequires(d,"Twisted>=1.5")
self.checkRequires(
d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
)
self.checkRequires(
d,"Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"]
)
self.checkRequires(
d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
["docgen","fastcgi"]
)
self.checkRequires(
d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
["fastcgi", "docgen"]
)
with pytest.raises(pkg_resources.UnknownExtra):
d.requires(["foo"])
示例4: _resolve_requirements
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import UnknownExtra [as 别名]
def _resolve_requirements(provider, distribution):
try:
requirements = distribution.requires([provider])
except pkg_resources.UnknownExtra:
# No extra for this provider
return True
else:
# Extra is defined
try:
for requirement in requirements:
if hasattr(requirement, 'name'):
pkg_resources.get_distribution(requirement.name)
else:
pkg_resources.get_distribution(requirement)
except (pkg_resources.DistributionNotFound, pkg_resources.VersionConflict):
# At least one extra requirement is not fulfilled
return False
return True
示例5: _load_entry_point
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import UnknownExtra [as 别名]
def _load_entry_point(ep_name, name=None):
"""Try to load the entry point ep_name that matches name."""
for ep in pkg_resources.iter_entry_points(ep_name, name=name):
try:
return ep.load()
except (ImportError, pkg_resources.UnknownExtra, AttributeError):
continue
示例6: discover_auth_systems
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import UnknownExtra [as 别名]
def discover_auth_systems():
"""Discover the available auth-systems.
This won't take into account the old style auth-systems.
"""
ep_name = 'openstack.client.auth_plugin'
for ep in pkg_resources.iter_entry_points(ep_name):
try:
auth_plugin = ep.load()
except (ImportError, pkg_resources.UnknownExtra, AttributeError) as e:
logger.debug("ERROR: Cannot load auth plugin %s" % ep.name)
logger.debug(e, exc_info=1)
else:
_discovered_plugins[ep.name] = auth_plugin
示例7: _load_plugin
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import UnknownExtra [as 别名]
def _load_plugin(self, ep: pkg_resources.EntryPoint):
try:
self.logger.debug(" Loading plugin %s" % ep)
plugin = ep.load(require=True)
self.logger.debug(" Initializing plugin %s" % ep)
plugin_context = copy.copy(self.app_context)
plugin_context.logger = self.logger.getChild(ep.name)
obj = plugin(plugin_context)
return Plugin(ep.name, ep, obj)
except ImportError as ie:
self.logger.warning("Plugin %r import failed: %s" % (ep, ie))
except pkg_resources.UnknownExtra as ue:
self.logger.warning("Plugin %r dependencies resolution failed: %s" % (ep, ue))