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


Python fetch.install_remote方法代码示例

本文整理汇总了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 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:31,代码来源:utils.py

示例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) 
开发者ID:juju,项目名称:charm-helpers,代码行数:30,代码来源:test_fetch.py


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