本文整理汇总了Python中kiwi.system.uri.Uri.translate方法的典型用法代码示例。如果您正苦于以下问题:Python Uri.translate方法的具体用法?Python Uri.translate怎么用?Python Uri.translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.system.uri.Uri
的用法示例。
在下文中一共展示了Uri.translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_translate_obs_project
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_obs_project(self, mock_request_get):
uri = Uri('obs://openSUSE:Leap:42.2/standard', 'yast2')
uri.runtime_config = self.runtime_config
uri.translate()
mock_request_get.assert_called_once_with(
'obs_server/openSUSE:/Leap:/42.2/standard'
)
示例2: test_destructor
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_destructor(self, mock_wipe, mock_mkdtemp, mock_manager):
mock_mkdtemp.return_value = 'tmpdir'
manager = mock.Mock()
manager.mountpoint = mock_mkdtemp.return_value
manager.is_mounted = mock.Mock(
return_value=True
)
mock_manager.return_value = manager
uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
uri.translate()
uri.__del__()
manager.umount.assert_called_once_with()
mock_wipe.assert_called_once_with(manager.mountpoint)
示例3: test_translate_obs_uri_inside_buildservice
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_obs_uri_inside_buildservice(
self, mock_buildservice, mock_warn
):
mock_buildservice.return_value = True
uri = Uri('obs://openSUSE:Leap:42.2/standard', 'rpm-md')
uri.runtime_config = self.runtime_config
assert uri.translate(False) == \
'obs_server/openSUSE:/Leap:/42.2/standard'
assert mock_warn.called
示例4: test_translate_buildservice_obsrepositories_container_path
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_buildservice_obsrepositories_container_path(
self, mock_buildservice
):
mock_buildservice.return_value = True
uri = Uri('obsrepositories:/container#latest', 'container')
assert uri.translate() == ''.join(
[
'/usr/src/packages/SOURCES/containers/',
'_obsrepositories/container#latest'
]
)
示例5: test_translate_iso_path
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_iso_path(self, mock_mkdtemp, mock_manager):
mock_mkdtemp.return_value = 'tmpdir'
manager = mock.Mock()
manager.mountpoint = mock_mkdtemp.return_value
mock_manager.return_value = manager
uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
result = uri.translate()
mock_manager.assert_called_once_with(
device='/image/CDs/openSUSE-13.2-DVD-x86_64.iso',
mountpoint='tmpdir'
)
manager.mount.assert_called_once_with()
assert result == 'tmpdir'
uri.mount_stack = []
示例6: import_repositories_marked_as_imageinclude
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def import_repositories_marked_as_imageinclude(self):
"""
Those <repository> sections which are marked with the
imageinclude attribute should be permanently added to
the image repository configuration
"""
repository_sections = \
self.xml_state.get_repository_sections_used_in_image()
root = RootInit(
root_dir=self.root_dir, allow_existing=True
)
repo = Repository(
RootBind(root), self.xml_state.get_package_manager()
)
repo.use_default_location()
for xml_repo in repository_sections:
repo_type = xml_repo.get_type()
repo_source = xml_repo.get_source().get_path()
repo_user = xml_repo.get_username()
repo_secret = xml_repo.get_password()
repo_alias = xml_repo.get_alias()
repo_priority = xml_repo.get_priority()
repo_dist = xml_repo.get_distribution()
repo_components = xml_repo.get_components()
repo_repository_gpgcheck = xml_repo.get_repository_gpgcheck()
repo_package_gpgcheck = xml_repo.get_package_gpgcheck()
uri = Uri(repo_source, repo_type)
repo_source_translated = uri.translate(
check_build_environment=False
)
if not repo_alias:
repo_alias = uri.alias()
log.info('Setting up image repository %s', repo_source)
log.info('--> Type: %s', repo_type)
log.info('--> Translated: %s', repo_source_translated)
log.info('--> Alias: %s', repo_alias)
repo.add_repo(
repo_alias, repo_source_translated,
repo_type, repo_priority, repo_dist, repo_components,
repo_user, repo_secret, uri.credentials_file_name(),
repo_repository_gpgcheck, repo_package_gpgcheck
)
示例7: test_translate_suse_buildservice_path
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_suse_buildservice_path(self):
uri = Uri('suse://openSUSE:13.2/standard', 'yast2')
assert uri.translate() == \
'/usr/src/packages/SOURCES/repos/openSUSE:13.2/standard'
示例8: test_translate_http_path
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_http_path(self):
uri = Uri('http://example.com/foo', 'rpm-md')
assert uri.translate() == 'http://example.com/foo'
示例9: test_translate_buildservice_path
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_buildservice_path(self, mock_buildservice):
mock_buildservice.return_value = True
uri = Uri('obs://openSUSE:13.2/standard', 'yast2')
assert uri.translate() == \
'/usr/src/packages/SOURCES/repos/openSUSE:13.2/standard'
示例10: test_translate_obs_project
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_obs_project(self):
uri = Uri('obs://Virt:Appliances/SLE_12', 'rpm-md')
assert uri.translate() == \
'http://download.opensuse.org/repositories/Virt:Appliances/SLE_12'
示例11: test_translate_dir_path
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_dir_path(self):
uri = Uri('dir:///some/path', 'rpm-md')
assert uri.translate() == '/some/path'
示例12: test_translate_ibs_project
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_ibs_project(self):
uri = Uri('ibs://Devel:PubCloud/SLE_12_GA', 'rpm-md')
assert uri.translate() == \
'http://download.suse.de/ibs/Devel:/PubCloud/SLE_12_GA'
示例13: test_translate_obs_distro
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_obs_distro(self):
uri = Uri('obs://13.2/repo/oss', 'yast2')
assert uri.translate() == \
'http://download.opensuse.org/distribution/13.2/repo/oss'
示例14: test_translate_unknown_style
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_unknown_style(self):
uri = Uri('xxx', 'rpm-md')
uri.translate()
示例15: test_translate_unsupported_style
# 需要导入模块: from kiwi.system.uri import Uri [as 别名]
# 或者: from kiwi.system.uri.Uri import translate [as 别名]
def test_translate_unsupported_style(self):
uri = Uri('ms://foo', 'rpm-md')
uri.translate()