当前位置: 首页>>代码示例>>Python>>正文


Python Policy.recalculate方法代码示例

本文整理汇总了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
开发者ID:pombredanne,项目名称:zero-install,代码行数:26,代码来源:testpolicy.py


注:本文中的zeroinstall.injector.policy.Policy.recalculate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。