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


Python ResolverPlayground.reload_config方法代码示例

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


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

示例1: testProfilePackageSet

# 需要导入模块: from portage.tests.resolver.ResolverPlayground import ResolverPlayground [as 别名]
# 或者: from portage.tests.resolver.ResolverPlayground.ResolverPlayground import reload_config [as 别名]
	def testProfilePackageSet(self):

		repo_configs = {
			"test_repo": {
				"layout.conf": ("profile-formats = profile-set",),
			}
		}

		profiles = (
			(
				'default/linux',
				{
					"eapi": ("5",),
					"packages": (
						"*sys-libs/A",
						"app-misc/A",
						"app-misc/B",
						"app-misc/C",
					),
				}
			),
			(
				'default/linux/x86',
				{
					"eapi": ("5",),
					"packages": (
						"-app-misc/B",
					),
					"parent": ("..",)
				}
			),
		)

		ebuilds = {
			"sys-libs/A-1": {
				"EAPI": "5",
			},
			"app-misc/A-1": {
				"EAPI": "5",
			},
			"app-misc/B-1": {
				"EAPI": "5",
			},
			"app-misc/C-1": {
				"EAPI": "5",
			},
		}

		installed = {
			"sys-libs/A-1": {
				"EAPI": "5",
			},
			"app-misc/A-1": {
				"EAPI": "5",
			},
			"app-misc/B-1": {
				"EAPI": "5",
			},
			"app-misc/C-1": {
				"EAPI": "5",
			},
		}

		test_cases = (

			ResolverPlaygroundTestCase(
				["@world"],
				options={"--update": True, "--deep": True},
				mergelist = [],
				success = True,
			),

			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True},
				success=True,
				cleanlist=["app-misc/B-1"]
			),

		)

		playground = ResolverPlayground(debug=False, ebuilds=ebuilds,
			installed=installed, repo_configs=repo_configs)
		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()
#.........这里部分代码省略.........
开发者ID:aeroniero33,项目名称:portage,代码行数:103,代码来源:test_profile_package_set.py

示例2: testProfileDefaultEAPI

# 需要导入模块: from portage.tests.resolver.ResolverPlayground import ResolverPlayground [as 别名]
# 或者: from portage.tests.resolver.ResolverPlayground.ResolverPlayground import reload_config [as 别名]
	def testProfileDefaultEAPI(self):

		repo_configs = {
			"test_repo": {
				"layout.conf": (
					"profile-formats = profile-default-eapi",
					"profile_eapi_when_unspecified = 5"
				),
			}
		}

		profiles = (
			(
				"",
				{
					"package.mask": ("sys-libs/A:1",),
					"package.use": ("sys-libs/A:1 flag",)
				}
			),
			(
				"default/linux",
				{
					"package.mask": ("sys-libs/B:1",),
					"package.use": ("sys-libs/B:1 flag",),
					"package.keywords": ("sys-libs/B:1 x86",)
				}
			),
			(
				"default/linux/x86",
				{
					"package.mask": ("sys-libs/C:1",),
					"package.use": ("sys-libs/C:1 flag",),
					"package.keywords": ("sys-libs/C:1 x86",),
					"parent": ("..",)
				}
			),
		)

		user_profile = {
			"package.mask": ("sys-libs/D:1",),
			"package.use": ("sys-libs/D:1 flag",),
			"package.keywords": ("sys-libs/D:1 x86",),
		}

		test_cases = (
			(lambda x: x._mask_manager._pmaskdict, {
				"sys-libs/A": ("sys-libs/A:1::test_repo",),
				"sys-libs/B": ("sys-libs/B:1",),
				"sys-libs/C": ("sys-libs/C:1",),
				"sys-libs/D": ("sys-libs/D:1",),
			}),
			(lambda x: x._use_manager._repo_puse_dict, {
				"test_repo": {
					"sys-libs/A": {
						"sys-libs/A:1": ("flag",)
					}
				}
			}),
			(lambda x: x._use_manager._pkgprofileuse, (
				{"sys-libs/B": {"sys-libs/B:1": "flag"}},
				{"sys-libs/C": {"sys-libs/C:1": "flag"}},
				{},
				{"sys-libs/D": {"sys-libs/D:1": "flag"}},
			)),
			(lambda x: x._keywords_manager._pkeywords_list, (
					{"sys-libs/B": {"sys-libs/B:1": ["x86"]}},
					{"sys-libs/C": {"sys-libs/C:1": ["x86"]}},
					{"sys-libs/D": {"sys-libs/D:1": ["x86"]}},
				)
			)
		)

		playground = ResolverPlayground(debug=False,
			repo_configs=repo_configs)
		try:
			repo_dir = (playground.settings.repositories.
				get_location_for_name("test_repo"))
			profile_root = os.path.join(repo_dir, "profiles")
			profile_info = [(os.path.join(profile_root, p), data)
				for p, data in profiles]
			profile_info.append((os.path.join(playground.eroot,
				USER_CONFIG_PATH, "profile"), user_profile))

			for prof_path, data in profile_info:
				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()

			for fn, expected in test_cases:
				result = self._translate_result(fn(playground.settings))
				self.assertEqual(result, expected)

		finally:
#.........这里部分代码省略.........
开发者ID:aeroniero33,项目名称:portage,代码行数:103,代码来源:test_profile_default_eapi.py

示例3: testUseExpandIncremental

# 需要导入模块: from portage.tests.resolver.ResolverPlayground import ResolverPlayground [as 别名]
# 或者: from portage.tests.resolver.ResolverPlayground.ResolverPlayground import reload_config [as 别名]
	def testUseExpandIncremental(self):

		profiles = (
			(
				'base',
				{
					"eapi": ("5",),
					"parent": ("..",),
					"make.defaults": (
						"INPUT_DEVICES=\"keyboard mouse\"",
						"PYTHON_TARGETS=\"python2_7 python3_3\"",
						("USE_EXPAND=\"INPUT_DEVICES PYTHON_TARGETS "
							"VIDEO_CARDS\""),
					)
				}
			),
			(
				'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()
#.........这里部分代码省略.........
开发者ID:aeroniero33,项目名称:portage,代码行数:103,代码来源:test_use_expand_incremental.py


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