當前位置: 首頁>>代碼示例>>Python>>正文


Python Policy.solve_with_downloads方法代碼示例

本文整理匯總了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
開發者ID:gvsurenderreddy,項目名稱:zeroinstall,代碼行數:28,代碼來源:testdownload.py

示例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
開發者ID:dabrahams,項目名稱:zeroinstall,代碼行數:25,代碼來源:testpolicy.py

示例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
開發者ID:gvsurenderreddy,項目名稱:zeroinstall,代碼行數:17,代碼來源:testdownload.py


注:本文中的zeroinstall.injector.policy.Policy.solve_with_downloads方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。