Esempio n. 1
0
def _connect_native_packages(env, pkg_install, lib_install):
    """Connect native installed packages to local versions.

    This helps setup a non-sudo environment to handle software
    that needs a local version in our non-root directory tree.
    """
    bin_dir = os.path.join(env.system_install, "bin")
    path = env.safe_run_output("echo $PATH")
    comment_line = "# CloudBioLinux PATH updates"
    if not env.safe_contains(env.shell_config, comment_line):
        env.safe_append(env.shell_config, "\n" + comment_line)
    if bin_dir not in path and env.safe_exists(env.shell_config):
        add_path = "export PATH=%s:$PATH" % bin_dir
        if not env.safe_contains(env.shell_config, add_path):
            env.safe_append(env.shell_config, add_path)
    ldlib_path = os.path.join(env.system_install, "lib")
    add_ldlibrary = "export LD_LIBRARY_PATH=%s:$LD_LIBRARY_PATH" % ldlib_path
    if not env.safe_contains(env.shell_config, add_ldlibrary):
        env.safe_append(env.shell_config, add_ldlibrary)
    perl_export = (
        "export PERL5LIB=%s/lib/perl5:%s/lib/perl5/site_perl:${PERL5LIB}" %
        (env.system_install, env.system_install))
    if not env.safe_contains(env.shell_config, perl_export):
        env.safe_append(env.shell_config, perl_export)
    if "python" in pkg_install and "python" in lib_install:
        _create_local_virtualenv(env.system_install)
Esempio n. 2
0
def _connect_native_packages(env, pkg_install, lib_install):
    """Connect native installed packages to local versions.

    This helps setup a non-sudo environment to handle software
    that needs a local version in our non-root directory tree.
    """
    bin_dir = os.path.join(env.system_install, "bin")
    path = env.safe_run_output("echo $PATH")
    comment_line = "# CloudBioLinux PATH updates"
    if not env.safe_contains(env.shell_config, comment_line):
        env.safe_append(env.shell_config, "\n" + comment_line)
    if bin_dir not in path and env.safe_exists(env.shell_config):
        add_path = "export PATH=%s:$PATH" % bin_dir
        if not env.safe_contains(env.shell_config, add_path):
            env.safe_append(env.shell_config, add_path)
    ldlib_path = os.path.join(env.system_install, "lib")
    add_ldlibrary = "export LD_LIBRARY_PATH=%s:$LD_LIBRARY_PATH" % ldlib_path
    if not env.safe_contains(env.shell_config, add_ldlibrary):
        env.safe_append(env.shell_config, add_ldlibrary)
    perl_export = ("export PERL5LIB=%s/lib/perl5:%s/lib/perl5/site_perl:${PERL5LIB}"
                   % (env.system_install, env.system_install))
    if not env.safe_contains(env.shell_config, perl_export):
        env.safe_append(env.shell_config, perl_export)
    if "python" in pkg_install and "python" in lib_install:
        _create_local_virtualenv(env.system_install)
Esempio n. 3
0
def _connect_native_packages(env, pkg_install, lib_install):
    """Connect native installed packages to local versions.

    This helps setup a non-sudo environment to handle software
    that needs a local version in our non-root directory tree.
    """
    bin_dir = os.path.join(env.system_install, "bin")
    exports = _get_shell_exports(env)
    path = env.safe_run_output("echo $PATH")
    comment_line = "# CloudBioLinux PATH updates"
    if not env.safe_contains(env.shell_config, comment_line):
        env.safe_append(env.shell_config, "\n" + comment_line)
    if bin_dir not in path and env.safe_exists(env.shell_config):
        if not env.safe_contains(env.shell_config, exports["path"]):
            env.safe_append(env.shell_config, exports["path"])
    if "python" in pkg_install and "python" in lib_install:
        _create_local_virtualenv(env.system_install)
Esempio n. 4
0
def local_append(filename, text, use_sudo=False, partial=False, escape=True, shell=False):
    func = use_sudo and env.safe_sudo or env.safe_run
    # Normalize non-list input to be a list
    if isinstance(text, basestring):
        text = [text]
    for line in text:
        regex = '^' + _escape_for_regex(line)  + ('' if partial else '$')
        if (env.safe_exists(filename, use_sudo=use_sudo) and line
            and env.safe_contains(filename, regex, use_sudo=use_sudo, escape=False,
                                  shell=shell)):
            continue
        line = line.replace("'", r"'\\''") if escape else line
        func("echo '%s' >> %s" % (line, _expand_path(filename)))
Esempio n. 5
0
def local_append(filename, text, use_sudo=False, partial=False, escape=True, shell=False):
    func = use_sudo and env.safe_sudo or env.safe_run
    # Normalize non-list input to be a list
    if isinstance(text, basestring):
        text = [text]
    for line in text:
        regex = '^' + _escape_for_regex(line)  + ('' if partial else '$')
        if (env.safe_exists(filename, use_sudo=use_sudo) and line
            and env.safe_contains(filename, regex, use_sudo=use_sudo, escape=False,
                                  shell=shell)):
            continue
        line = line.replace("'", r"'\\''") if escape else line
        func("echo '%s' >> %s" % (line, _expand_path(filename)))