def install_gemini(env): """A lightweight db framework for disease and population genetics. https://github.com/arq5x/gemini """ version = "0.6.4" if versioncheck.up_to_date(env, "gemini -v", version, stdout_flag="gemini"): return elif not shared._executable_not_on_path("gemini -v"): env.safe_run("gemini update") else: iurl = "https://raw.github.com/arq5x/gemini/master/gemini/scripts/gemini_install.py" data_dir = os.path.join( env.system_install, "local" if env.system_install.find("/local") == -1 else "", "share", "gemini") with _make_tmp_dir(ext="-gemini") as work_dir: with cd(work_dir): if env.safe_exists(os.path.basename(iurl)): env.safe_run("rm -f %s" % os.path.basename(iurl)) installer = shared._remote_fetch(env, iurl) env.safe_run("%s %s %s %s %s" % (_python_cmd(env), installer, "" if env.use_sudo else "--nosudo", env.system_install, data_dir)) env.safe_run("rm -f gemini_install.py")
def get_installed_version(env, cmd, version, args=None, stdout_flag=None, stdout_index=-1): """Check if the given command is up to date with the provided version. """ if shared._executable_not_on_path(cmd): return False if args: cmd = cmd + " " + " ".join(args) with quiet(): path_safe = ( "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:{s}/lib/pkgconfig && " "export PATH=$PATH:{s}/bin && " "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{s}/lib && ".format( s=env.system_install)) out = env.safe_run_output(path_safe + cmd) if stdout_flag: iversion = _parse_from_stdoutflag(out, stdout_flag, stdout_index) else: iversion = out.strip() iversion = _clean_version(iversion) if " not found in the pkg-config search path" in iversion: return False return iversion
def _download_executables(env, base_url, tools): install_dir = shared._get_bin_dir(env) with _make_tmp_dir() as work_dir: with cd(work_dir): for tool in tools: final_tool = os.path.join(install_dir, tool) if not env.safe_exists(final_tool) and shared._executable_not_on_path(tool): shared._remote_fetch(env, "%s%s" % (base_url, tool)) env.safe_sudo("cp -f %s %s" % (tool, install_dir))
def _download_executables(env, base_url, tools): install_dir = shared._get_bin_dir(env) with _make_tmp_dir() as work_dir: with cd(work_dir): for tool in tools: final_tool = os.path.join(install_dir, tool) if not env.safe_exists(final_tool) and shared._executable_not_on_path(tool): env.safe_run("wget %s%s" % (base_url, tool)) env.safe_sudo("cp -f %s %s" % (tool, install_dir))
def up_to_date(env, cmd, version, args=None, stdout_flag=None): """Check if the given command is up to date with the provided version. """ if shared._executable_not_on_path(cmd): return False if args: cmd = cmd + " " + " ".join(args) with quiet(): out = env.safe_run_output(cmd) if stdout_flag: iversion = _parse_from_stdoutflag(out, stdout_flag) else: iversion = out.strip() return LooseVersion(iversion) >= LooseVersion(version)
def up_to_date(env, cmd, version, args=None, stdout_flag=None, stdout_index=-1): """Check if the given command is up to date with the provided version. """ if shared._executable_not_on_path(cmd): return False if args: cmd = cmd + " " + " ".join(args) with quiet(): path_safe = "export PATH=$PATH:%s/bin && " % env.system_install out = env.safe_run_output(path_safe + cmd) if stdout_flag: iversion = _parse_from_stdoutflag(out, stdout_flag, stdout_index) else: iversion = out.strip() iversion = _clean_version(iversion) return LooseVersion(iversion) >= LooseVersion(version)
def get_installed_version(env, cmd, version, args=None, stdout_flag=None, stdout_index=-1): """Check if the given command is up to date with the provided version. """ if shared._executable_not_on_path(cmd): return False if args: cmd = cmd + " " + " ".join(args) with quiet(): path_safe = ("export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:{s}/lib/pkgconfig && " "export PATH=$PATH:{s}/bin && " "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{s}/lib && ".format(s=env.system_install)) out = env.safe_run_output(path_safe + cmd) if stdout_flag: iversion = _parse_from_stdoutflag(out, stdout_flag, stdout_index) else: iversion = out.strip() iversion = _clean_version(iversion) return iversion
def up_to_date(env, cmd, version, args=None, stdout_flag=None, stdout_index=-1): """Check if the given command is up to date with the provided version. """ if shared._executable_not_on_path(cmd): return False if args: cmd = cmd + " " + " ".join(args) with quiet(): path_safe = "export PATH=$PATH:%s/bin && " out = env.safe_run_output(path_safe + cmd) if stdout_flag: iversion = _parse_from_stdoutflag(out, stdout_flag, stdout_index) else: iversion = out.strip() iversion = _clean_version(iversion) return LooseVersion(iversion) >= LooseVersion(version)
def install_gemini(env): """A lightweight db framework for disease and population genetics. https://github.com/arq5x/gemini """ version = "0.6.1" if versioncheck.up_to_date(env, "gemini -v", version, stdout_flag="gemini"): return elif not shared._executable_not_on_path("gemini -v"): env.safe_run("gemini update") else: iurl = "https://raw.github.com/arq5x/gemini/master/gemini/scripts/gemini_install.py" data_dir = os.path.join(env.system_install, "local" if env.system_install.find("/local") == -1 else "", "share", "gemini") with _make_tmp_dir(ext="-gemini") as work_dir: with cd(work_dir): if env.safe_exists(os.path.basename(iurl)): env.safe_run("rm -f %s" % os.path.basename(iurl)) installer = shared._remote_fetch(env, iurl) env.safe_run("%s %s %s %s %s" % (_python_cmd(env), installer, "" if env.use_sudo else "--nosudo", env.system_install, data_dir)) env.safe_run("rm -f gemini_install.py")
def decorator(*args, **kwargs): if not shared._executable_not_on_path(pname): return func(*args, **kwargs)