示例#1
0
def install_pip(python_cmd='python', use_sudo=True):
    """
    Install the latest version of `pip`_, using the given Python
    interpreter.

    ::

        import fabtools

        if not fabtools.python.is_pip_installed():
            fabtools.python.install_pip()

    .. note::
        pip is automatically installed inside a virtualenv, so there
        is no need to install it yourself in this case.

    .. _pip: http://www.pip-installer.org/
    """

    with cd('/tmp'):

        download(GET_PIP_URL)

        command = '%(python_cmd)s get-pip.py' % locals()
        if use_sudo:
            run_as_root(command, pty=False)
        else:
            run(command, pty=False)

        run('rm -f get-pip.py')
示例#2
0
def install_pip(python_cmd='python', use_sudo=True):
    """
    Install the latest version of `pip`_, using the given Python
    interpreter.

    ::

        import fabtools

        if not fabtools.python.is_pip_installed():
            fabtools.python.install_pip()

    .. note::
        pip is automatically installed inside a virtualenv, so there
        is no need to install it yourself in this case.

    .. _pip: http://www.pip-installer.org/
    """

    with cd('/tmp'):

        download(GET_PIP_URL)

        command = '%(python_cmd)s get-pip.py' % locals()
        if use_sudo:
            run_as_root(command, pty=False)
        else:
            run(command, pty=False)

        run('rm -f get-pip.py')
示例#3
0
文件: conda.py 项目: AMOSoft/fabtools
def install_miniconda(prefix='~/miniconda', use_sudo=False, keep_installer=False):
    """
    Install the latest version of `miniconda`_.

    :param prefix: prefix for the miniconda installation
    :param use_sudo: use sudo for this operation
    :param keep_installer: keep the miniconda installer after installing

    ::

        import fabtools

        fabtools.conda.install_miniconda()

    """

    with cd("/tmp"):
        if not fabtools.files.is_file('Miniconda-latest-Linux-x86_64.sh'):
            download(MINICONDA_URL)

        command = 'bash Miniconda-latest-Linux-x86_64.sh -b -p %(prefix)s' % locals()
        if use_sudo:
            run_as_root(command)
        else:
            run(command)
        files.append('~/.bash_profile', 'export PATH=%(prefix)s/bin:$PATH' % locals())

        if not keep_installer:
            run('rm -f Miniconda-latest-Linux-x86_64.sh')
示例#4
0
def install_miniconda(prefix='~/miniconda',
                      use_sudo=False,
                      keep_installer=False):
    """
    Install the latest version of `miniconda`_.

    :param prefix: prefix for the miniconda installation
    :param use_sudo: use sudo for this operation
    :param keep_installer: keep the miniconda installer after installing

    ::

        import fabtools

        fabtools.conda.install_miniconda()

    """

    with cd("/tmp"):
        if not fabtools.files.is_file('Miniconda-latest-Linux-x86_64.sh'):
            download(MINICONDA_URL)

        command = 'bash Miniconda-latest-Linux-x86_64.sh -b -p %(prefix)s' % locals(
        )
        if use_sudo:
            run_as_root(command)
        else:
            run(command)
        files.append('~/.bash_profile',
                     'export PATH=%(prefix)s/bin:$PATH' % locals())

        if not keep_installer:
            run('rm -f Miniconda-latest-Linux-x86_64.sh')
def _install_from_scratch(python_cmd, use_sudo):
    """
    Install setuptools from scratch using installer
    """

    with cd("/tmp"):
        download(EZ_SETUP_URL)

        command = '%(python_cmd)s ez_setup.py' % locals()
        if use_sudo:
            run_as_root(command)
        else:
            run(command)

        run('rm -f ez_setup.py')
示例#6
0
def _install_from_scratch(python_cmd, use_sudo):
    """
    Install setuptools from scratch using installer
    """

    with cd("/tmp"):
        download(EZ_SETUP_URL)

        command = '%(python_cmd)s ez_setup.py' % locals()
        if use_sudo:
            run_as_root(command)
        else:
            run(command)

        run('rm -f ez_setup.py')