本文整理匯總了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))