本文整理汇总了Python中zeroinstall.injector.policy.Policy.recalculate方法的典型用法代码示例。如果您正苦于以下问题:Python Policy.recalculate方法的具体用法?Python Policy.recalculate怎么用?Python Policy.recalculate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zeroinstall.injector.policy.Policy
的用法示例。
在下文中一共展示了Policy.recalculate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSource
# 需要导入模块: from zeroinstall.injector.policy import Policy [as 别名]
# 或者: from zeroinstall.injector.policy.Policy import recalculate [as 别名]
def testSource(self):
iface_cache = self.config.iface_cache
warnings.filterwarnings("ignore", category=DeprecationWarning)
foo = iface_cache.get_interface("http://foo/Binary.xml")
self.import_feed(foo.uri, "Binary.xml")
foo_src = iface_cache.get_interface("http://foo/Source.xml")
self.import_feed(foo_src.uri, "Source.xml")
compiler = iface_cache.get_interface("http://foo/Compiler.xml")
self.import_feed(compiler.uri, "Compiler.xml")
p = Policy("http://foo/Binary.xml", config=self.config)
p.freshness = 0
p.network_use = model.network_full
p.recalculate() # Deprecated
assert p.implementation[foo].id == "sha1=123"
# Now ask for source instead
p.requirements.source = True
p.requirements.command = "compile"
p.recalculate()
assert p.solver.ready, p.solver.get_failure_reason()
assert p.implementation[foo].id == "sha1=234" # The source
assert p.implementation[compiler].id == "sha1=345" # A binary needed to compile it