# Path: cloudbio/fabutils.py
# def quiet():
#     return settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True)
# 
# Path: cloudbio/fabutils.py
# def configure_runsudo(env):
#     """Setup env variable with safe_sudo and safe_run,
#     supporting non-privileged users and local execution.
#     """
#     env.is_local = env.hosts == ["localhost"]
#     if env.is_local:
#         env.safe_put = local_put
#         env.safe_sed = local_sed
#         env.safe_comment = local_comment
#         env.safe_contains = local_contains
#         env.safe_append = local_append
#         env.safe_exists = local_exists
#         env.safe_run = run_local()
#         env.safe_run_output = run_local(capture=True)
#     else:
#         env.safe_put = put
#         env.safe_sed = sed
#         env.safe_comment = comment
#         env.safe_contains = contains
#         env.safe_append = append
#         env.safe_exists = exists
#         env.safe_run = run
#         env.safe_run_output = run_output
#     if isinstance(getattr(env, "use_sudo", "true"), six.string_types):
#         if getattr(env, "use_sudo", "true").lower() in ["true", "yes"]:
#             env.use_sudo = True
#             if env.is_local:
#                 env.safe_sudo = run_local(True)
#             else:
#                 env.safe_sudo = sudo
#         else:
#             env.use_sudo = False
#             if env.is_local:
#                 env.safe_sudo = run_local()
#             else:
#                 env.safe_sudo = run


import os
import subprocess
from fabric.api import env
from cloudbio.fabutils import quiet
from cloudbio.fabutils import configure_runsudo
from cloudbio.custom import system
    name = version
    env.logger.debug("Source=%s" % name)
    final = []
    for s in sources:
        if s.find("%s") > 0:
            s = s % name
        final.append(s)
    return final


def _ubuntu_dist_name(env):
    """
    Determine Ubuntu dist name (e.g. precise or quantal).
    """
    return env.safe_run_output("cat /etc/*release | grep DISTRIB_CODENAME | cut -f 2 -d =")


def _debian_dist_name(env):
    """
    Determine Debian dist name (e.g. squeeze).
    """
    return env.safe_run_output("lsb_release -a | grep Codename | cut -f 2")


def _determine_distribution(env):
    """
    Attempt to automatically determine the distribution of the target machine.

    Currently works for Ubuntu, CentOS, Debian, Scientific Linux and Mac OS X.
    """

# Path: cloudbio/fabutils.py
# def quiet():
#     return settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True)
# 
# Path: cloudbio/fabutils.py
# def configure_runsudo(env):
#     """Setup env variable with safe_sudo and safe_run,
#     supporting non-privileged users and local execution.
#     """
#     env.is_local = env.hosts == ["localhost"]
#     if env.is_local:
#         env.safe_put = local_put
#         env.safe_sed = local_sed
#         env.safe_comment = local_comment
#         env.safe_contains = local_contains
#         env.safe_append = local_append
#         env.safe_exists = local_exists
#         env.safe_run = run_local()
#         env.safe_run_output = run_local(capture=True)
#     else:
#         env.safe_put = put
#         env.safe_sed = sed
#         env.safe_comment = comment
#         env.safe_contains = contains
#         env.safe_append = append
#         env.safe_exists = exists
#         env.safe_run = run
#         env.safe_run_output = run_output
#     if isinstance(getattr(env, "use_sudo", "true"), six.string_types):
#         if getattr(env, "use_sudo", "true").lower() in ["true", "yes"]:
#             env.use_sudo = True
#             if env.is_local:
#                 env.safe_sudo = run_local(True)
#             else:
#                 env.safe_sudo = sudo
#         else:
#             env.use_sudo = False
#             if env.is_local:
#                 env.safe_sudo = run_local()
#             else:
#                 env.safe_sudo = run


# Path: cloudbio/distribution.py
import os
import subprocess
from fabric.api import env
from cloudbio.fabutils import quiet
from cloudbio.fabutils import configure_runsudo
from cloudbio.custom import system

    name = version
    env.logger.debug("Source=%s" % name)
    final = []
    for s in sources:
        if s.find("%s") > 0:
            s = s % name
        final.append(s)
    return final


def _ubuntu_dist_name(env):
    """
    Determine Ubuntu dist name (e.g. precise or quantal).
    """
    return env.safe_run_output("cat /etc/*release | grep DISTRIB_CODENAME | cut -f 2 -d =")


def _debian_dist_name(env):
    """
    Determine Debian dist name (e.g. squeeze).
    """
    return env.safe_run_output("lsb_release -a | grep Codename | cut -f 2")


def _determine_distribution(env):
    """
    Attempt to automatically determine the distribution of the target machine.

    Currently works for Ubuntu, CentOS, Debian, Scientific Linux and Mac OS X.
    """

    with quiet():