本文整理汇总了Python中zeroinstall.injector.requirements.Requirements.parse_options方法的典型用法代码示例。如果您正苦于以下问题:Python Requirements.parse_options方法的具体用法?Python Requirements.parse_options怎么用?Python Requirements.parse_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zeroinstall.injector.requirements.Requirements
的用法示例。
在下文中一共展示了Requirements.parse_options方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_selections
# 需要导入模块: from zeroinstall.injector.requirements import Requirements [as 别名]
# 或者: from zeroinstall.injector.requirements.Requirements import parse_options [as 别名]
def get_selections(config, options, iface_uri, select_only, download_only, test_callback, requirements = None):
"""Get selections for iface_uri, according to the options passed.
Will switch to GUI mode if necessary.
@param options: options from OptionParser
@param iface_uri: canonical URI of the interface
@param select_only: return immediately even if the selected versions aren't cached
@param download_only: wait for stale feeds, and display GUI button as Download, not Run
@param requirements: requirements to use; if None, requirements come from options (since 1.15)
@type requirements: Requirements
@return: the selected versions, or None if the user cancels
@rtype: L{selections.Selections} | None
"""
if options.offline:
config.network_use = model.network_offline
iface_cache = config.iface_cache
# Try to load it as a feed. If it is a feed, it'll get cached. If not, it's a
# selections document and we return immediately.
maybe_selections = iface_cache.get_feed(iface_uri, selections_ok = True)
if isinstance(maybe_selections, selections.Selections):
if not select_only:
blocker = maybe_selections.download_missing(config)
if blocker:
logger.info(_("Waiting for selected implementations to be downloaded..."))
tasks.wait_for_blocker(blocker)
return maybe_selections
if requirements is None:
requirements = Requirements(iface_uri)
requirements.parse_options(options)
return get_selections_for(requirements, config, options, select_only, download_only, test_callback)