Exemplo n.º 1
0
def install_requirements(upgrade=False):
    """Install `site` project's requirements"""
    site = get_project_name()
    project_dir = get_proj_config()['project_dir']

    pip = _get_virtualenv_bin(site, 'pip')
    requirements = open("{}/requirements.txt".format(project_dir)).read().replace("\n", " ")
    fab.sudo("{pip} install {upgrade} {requirements}".format(
             pip=pip, upgrade="--upgrade" if upgrade else "",
             requirements=requirements))
Exemplo n.º 2
0
def install_requirements(upgrade=False):
    """Install `site` project's requirements"""
    site = get_project_name()
    project_dir = get_proj_config()['project_dir']

    pip = _get_virtualenv_bin(site, 'pip')
    requirements = open(
        "{}/requirements.txt".format(project_dir)).read().replace("\n", " ")
    fab.sudo("{pip} install {upgrade} {requirements}".format(
        pip=pip,
        upgrade="--upgrade" if upgrade else "",
        requirements=requirements))
Exemplo n.º 3
0
def create_virtualenv():
    """Create virtualenv for project."""
    site = get_project_name()
    version = get_config()['version']

    virtualenv_dir = "{}/{}/virtualenv".format(SITES_DIR, site)
    if cuisine.dir_exists(virtualenv_dir + "/bin"):
        fab.puts("virtualenv for {0} already exists".format(site))
        return

    with cuisine.mode_sudo():
        cuisine.dir_ensure(virtualenv_dir, recursive=True)

    venv_bin = _python_bin_path(version, 'virtualenv')
    fab.sudo("{venv_bin} {virtualenv_dir}".format(venv_bin=venv_bin,
             virtualenv_dir=virtualenv_dir))
Exemplo n.º 4
0
def create_virtualenv():
    """Create virtualenv for project."""
    site = get_project_name()
    version = get_config()['version']

    virtualenv_dir = "{}/{}/virtualenv".format(SITES_DIR, site)
    if cuisine.dir_exists(virtualenv_dir + "/bin"):
        fab.puts("virtualenv for {0} already exists".format(site))
        return

    with cuisine.mode_sudo():
        cuisine.dir_ensure(virtualenv_dir, recursive=True)

    venv_bin = _python_bin_path(version, 'virtualenv')
    fab.sudo("{venv_bin} {virtualenv_dir}".format(
        venv_bin=venv_bin, virtualenv_dir=virtualenv_dir))
Exemplo n.º 5
0
def uninstall_pypi_package(package, use_virtualenv=True):
    """Uninstall pypi package `package` on python `py_version`."""
    py_version = get_config()['version']

    fab.puts("Uninstalling pypi package {0} on python {1}".format(package, py_version))

    if use_virtualenv:
        site = get_project_name()
        pip_bin = _get_virtualenv_bin(site, 'pip')
    else:
        pip_bin = _python_bin_path(py_version, 'pip')

    if not cuisine.file_exists(pip_bin):
        fab.puts("pip for version {0} not found".format(py_version))
        return

    fab.sudo('{cmd} uninstall --yes {package}'.format(cmd=pip_bin, package=package))
Exemplo n.º 6
0
def install_pypi_package(package, use_virtualenv=True):
    """Install pypi package `package` on python `py_version`."""
    py_version = get_config()['version']

    fab.puts("Installing pypi package {0} on python {1}".format(
        package, py_version))

    if use_virtualenv:
        site = get_project_name()
        pip_bin = _get_virtualenv_bin(site, 'pip')
    else:
        pip_bin = _python_bin_path(py_version, 'pip')

    if not cuisine.file_exists(pip_bin):
        fab.puts("pip for version {0} not found".format(py_version))
        return

    fab.sudo('{cmd} install {package}'.format(cmd=pip_bin, package=package))