本文整理汇总了Python中charmhelpers.fetch.install_remote方法的典型用法代码示例。如果您正苦于以下问题:Python fetch.install_remote方法的具体用法?Python fetch.install_remote怎么用?Python fetch.install_remote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charmhelpers.fetch
的用法示例。
在下文中一共展示了fetch.install_remote方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _git_clone_and_install_single
# 需要导入模块: from charmhelpers import fetch [as 别名]
# 或者: from charmhelpers.fetch import install_remote [as 别名]
def _git_clone_and_install_single(repo, branch, depth, parent_dir, http_proxy,
update_requirements):
"""
Clone and install a single git repository.
"""
if not os.path.exists(parent_dir):
juju_log('Directory already exists at {}. '
'No need to create directory.'.format(parent_dir))
os.mkdir(parent_dir)
juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch))
repo_dir = install_remote(
repo, dest=parent_dir, branch=branch, depth=depth)
venv = os.path.join(parent_dir, 'venv')
if update_requirements:
if not requirements_dir:
error_out('requirements repo must be cloned before '
'updating from global requirements.')
_git_update_requirements(venv, repo_dir, requirements_dir)
juju_log('Installing git repo from dir: {}'.format(repo_dir))
if http_proxy:
pip_install(repo_dir, proxy=http_proxy, venv=venv)
else:
pip_install(repo_dir, venv=venv)
return repo_dir
示例2: test_installs_remote
# 需要导入模块: from charmhelpers import fetch [as 别名]
# 或者: from charmhelpers.fetch import install_remote [as 别名]
def test_installs_remote(self, _plugins, _log):
h1 = MagicMock(name="h1")
h1.can_handle.return_value = "Nope"
h2 = MagicMock(name="h2")
h2.can_handle.return_value = True
h2.install.side_effect = fetch.UnhandledSource()
h3 = MagicMock(name="h3")
h3.can_handle.return_value = True
h3.install.return_value = "foo"
_plugins.return_value = [h1, h2, h3]
for url in self.valid_urls:
result = fetch.install_remote(url)
h1.can_handle.assert_called_with(url)
h2.can_handle.assert_called_with(url)
h3.can_handle.assert_called_with(url)
h1.install.assert_not_called()
h2.install.assert_called_with(url)
h3.install.assert_called_with(url)
self.assertEqual(result, "foo")
fetch.install_remote('url', extra_arg=True)
h2.install.assert_called_with('url', extra_arg=True)