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


Python ResolverPlayground.run方法代码示例

本文整理汇总了Python中portage.tests.resolver.ResolverPlayground.ResolverPlayground.run方法的典型用法代码示例。如果您正苦于以下问题:Python ResolverPlayground.run方法的具体用法?Python ResolverPlayground.run怎么用?Python ResolverPlayground.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在portage.tests.resolver.ResolverPlayground.ResolverPlayground的用法示例。


在下文中一共展示了ResolverPlayground.run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testSetCpv

# 需要导入模块: from portage.tests.resolver.ResolverPlayground import ResolverPlayground [as 别名]
# 或者: from portage.tests.resolver.ResolverPlayground.ResolverPlayground import run [as 别名]
	def testSetCpv(self):
		"""
		Test the clone via constructor.
		"""

		ebuilds = {
			"dev-libs/A-1": {"IUSE": "static-libs"},
			"dev-libs/B-1": {"IUSE": "static-libs"},
		}

		env_files = {
			"A" : ("USE=\"static-libs\"",)
		}

		package_env = (
			"dev-libs/A A",
		)

		eprefix = normalize_path(tempfile.mkdtemp())
		playground = None
		try:
			user_config_dir = os.path.join(eprefix, USER_CONFIG_PATH)
			os.makedirs(user_config_dir)

			with io.open(os.path.join(user_config_dir, "package.env"),
				mode='w', encoding=_encodings['content']) as f:
				for line in package_env:
					f.write(line + "\n")

			env_dir = os.path.join(user_config_dir, "env")
			os.makedirs(env_dir)
			for k, v in env_files.items():
				with io.open(os.path.join(env_dir, k), mode='w',
					encoding=_encodings['content']) as f:
					for line in v:
						f.write(line + "\n")

			playground = ResolverPlayground(eprefix=eprefix, ebuilds=ebuilds)
			settings = config(clone=playground.settings)

			result = playground.run(["=dev-libs/A-1"])
			pkg, existing_node = result.depgraph._select_package(
				playground.eroot, Atom("=dev-libs/A-1"))
			settings.setcpv(pkg)
			self.assertTrue("static-libs" in
				settings["PORTAGE_USE"].split())

			# Test bug #522362, where a USE=static-libs package.env
			# setting leaked from one setcpv call to the next.
			pkg, existing_node = result.depgraph._select_package(
				playground.eroot, Atom("=dev-libs/B-1"))
			settings.setcpv(pkg)
			self.assertTrue("static-libs" not in
				settings["PORTAGE_USE"].split())

		finally:
			if playground is None:
				shutil.rmtree(eprefix)
			else:
				playground.cleanup()
开发者ID:gentoo,项目名称:portage,代码行数:62,代码来源:test_config.py

示例2: testClone

# 需要导入模块: from portage.tests.resolver.ResolverPlayground import ResolverPlayground [as 别名]
# 或者: from portage.tests.resolver.ResolverPlayground.ResolverPlayground import run [as 别名]
    def testClone(self):
        """
		Test the clone via constructor.
		"""

        ebuilds = {"dev-libs/A-1": {}}

        playground = ResolverPlayground(ebuilds=ebuilds)
        try:
            settings = config(clone=playground.settings)
            result = playground.run(["=dev-libs/A-1"])
            pkg, existing_node = result.depgraph._select_package(playground.eroot, "=dev-libs/A-1")
            settings.setcpv(pkg)

            # clone after setcpv tests deepcopy of LazyItemsDict
            settings2 = config(clone=settings)
        finally:
            playground.cleanup()
开发者ID:sysrqb,项目名称:portage-funtoo,代码行数:20,代码来源:test_config.py

示例3: testUseExpandIncremental

# 需要导入模块: from portage.tests.resolver.ResolverPlayground import ResolverPlayground [as 别名]
# 或者: from portage.tests.resolver.ResolverPlayground.ResolverPlayground import run [as 别名]

#.........这里部分代码省略.........
			(
				'default/linux',
				{
					"eapi": ("5",),
					"make.defaults": (
						"VIDEO_CARDS=\"dummy fbdev v4l\"",
					)
				}
			),
			(
				'default/linux/x86',
				{
					"eapi": ("5",),
					"make.defaults": (
						# Test negative incremental for bug 530222.
						"PYTHON_TARGETS=\"-python3_3\"",
					),
					"parent": ("../../../base",
						"../../../mixins/python/3.4",
						".."
					)
				}
			),
			(
				'mixins/python/3.4',
				{
					"eapi": ("5",),
					"make.defaults": (
						"PYTHON_TARGETS=\"python3_4\"",
					)
				}
			),
		)

		# USE_EXPAND variable settings in make.conf will cause
		# profile settings for the same variable to be discarded
		# (non-incremental behavior). PMS does not govern make.conf
		# behavior.
		user_config = {
			"make.conf" : (
				"VIDEO_CARDS=\"intel\"",
			)
		}

		ebuilds = {
			"x11-base/xorg-drivers-1.15": {
				"EAPI": "5",
				"IUSE": ("input_devices_keyboard input_devices_mouse "
					"videos_cards_dummy video_cards_fbdev "
					"video_cards_v4l video_cards_intel")
			},
			"sys-apps/portage-2.2.14": {
				"EAPI": "5",
				"IUSE": ("python_targets_python2_7 "
					"python_targets_python3_3 python_targets_python3_4")
			},
		}

		package_expected_use = (
			("x11-base/xorg-drivers-1.15", ("input_devices_keyboard",
				"input_devices_mouse", "video_cards_intel",)),
			("sys-apps/portage-2.2.14", ("python_targets_python2_7",
				"python_targets_python3_4"))
		)

		playground = ResolverPlayground(debug=False,
			ebuilds=ebuilds, user_config=user_config)
		try:
			repo_dir = (playground.settings.repositories.
				get_location_for_name("test_repo"))
			profile_root = os.path.join(repo_dir, "profiles")

			for p, data in profiles:
				prof_path = os.path.join(profile_root, p)
				ensure_dirs(prof_path)
				for k, v in data.items():
					with io.open(os.path.join(prof_path, k), mode="w",
						encoding=_encodings["repo.content"]) as f:
						for line in v:
							f.write("%s\n" % line)

			# The config must be reloaded in order to account
			# for the above profile customizations.
			playground.reload_config()

			depgraph = playground.run(
				["=x11-base/xorg-drivers-1.15"]).depgraph
			settings = config(clone=playground.settings)

			for cpv, expected_use in package_expected_use:
				pkg, existing_node = depgraph._select_package(
					playground.eroot, Atom("=" + cpv))
				settings.setcpv(pkg)
				expected = frozenset(expected_use)
				got = frozenset(settings["PORTAGE_USE"].split())
				self.assertEqual(got, expected,
					"%s != %s" % (got, expected))

		finally:
			playground.cleanup()
开发者ID:aeroniero33,项目名称:portage,代码行数:104,代码来源:test_use_expand_incremental.py


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