本文整理汇总了Python中zeroinstall.injector.policy.Policy.solve_with_downloads方法的典型用法代码示例。如果您正苦于以下问题:Python Policy.solve_with_downloads方法的具体用法?Python Policy.solve_with_downloads怎么用?Python Policy.solve_with_downloads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zeroinstall.injector.policy.Policy
的用法示例。
在下文中一共展示了Policy.solve_with_downloads方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDistro
# 需要导入模块: from zeroinstall.injector.policy import Policy [as 别名]
# 或者: from zeroinstall.injector.policy.Policy import solve_with_downloads [as 别名]
def testDistro(self):
with output_suppressed():
native_url = 'http://example.com:8000/Native.xml'
# Initially, we don't have the feed at all...
master_feed = self.config.iface_cache.get_feed(native_url)
assert master_feed is None, master_feed
trust.trust_db.trust_key('DE937DD411906ACF7C263B396FCF121BE2390E0B', 'example.com:8000')
self.child = server.handle_requests('Native.xml', '6FCF121BE2390E0B.gpg', '/key-info/key/DE937DD411906ACF7C263B396FCF121BE2390E0B')
policy = Policy(native_url, config = self.config)
assert policy.need_download()
solve = policy.solve_with_downloads()
self.config.handler.wait_for_blocker(solve)
tasks.check(solve)
master_feed = self.config.iface_cache.get_feed(native_url)
assert master_feed is not None
assert master_feed.implementations == {}
distro_feed_url = master_feed.get_distro_feed()
assert distro_feed_url is not None
distro_feed = self.config.iface_cache.get_feed(distro_feed_url)
assert distro_feed is not None
assert len(distro_feed.implementations) == 2, distro_feed.implementations
示例2: testSource
# 需要导入模块: from zeroinstall.injector.policy import Policy [as 别名]
# 或者: from zeroinstall.injector.policy.Policy import solve_with_downloads [as 别名]
def testSource(self):
iface_cache = self.config.iface_cache
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')
self.config.freshness = 0
self.config.network_use = model.network_full
p = Policy('http://foo/Binary.xml', config = self.config)
tasks.wait_for_blocker(p.solve_with_downloads())
assert p.implementation[foo].id == 'sha1=123'
# Now ask for source instead
p.requirements.source = True
p.requirements.command = 'compile'
tasks.wait_for_blocker(p.solve_with_downloads())
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
示例3: testMirrors
# 需要导入模块: from zeroinstall.injector.policy import Policy [as 别名]
# 或者: from zeroinstall.injector.policy.Policy import solve_with_downloads [as 别名]
def testMirrors(self):
old_out = sys.stdout
try:
sys.stdout = StringIO()
getLogger().setLevel(ERROR)
trust.trust_db.trust_key('DE937DD411906ACF7C263B396FCF121BE2390E0B', 'example.com:8000')
self.child = server.handle_requests(server.Give404('/Hello.xml'), 'latest.xml', '/0mirror/keys/6FCF121BE2390E0B.gpg')
policy = Policy('http://example.com:8000/Hello.xml', config = self.config)
self.config.feed_mirror = 'http://example.com:8000/0mirror'
refreshed = policy.solve_with_downloads()
policy.handler.wait_for_blocker(refreshed)
assert policy.ready
finally:
sys.stdout = old_out