From 74151c34ce365fd61cadeff75ab35ccee3c19da2 Mon Sep 17 00:00:00 2001 From: Alexandre Cormier Date: Mon, 4 Jul 2022 09:25:18 +0200 Subject: [PATCH] rm ifremer and create a specific branch --- lib/ifremer.py | 49 ------------------------------------------------- tooldir | 12 ------------ 2 files changed, 61 deletions(-) delete mode 100644 lib/ifremer.py diff --git a/lib/ifremer.py b/lib/ifremer.py deleted file mode 100644 index a019929..0000000 --- a/lib/ifremer.py +++ /dev/null @@ -1,49 +0,0 @@ -import os -import sys - - -def eprint(*args, **kwargs): - print(*args, file=sys.stderr, **kwargs) - - -def make_tool_dir(params, args): - install_dir_path = params['install_dir_path'] - tool_name = args.tool_name - tool_version = args.tool_version - path_tool = os.path.join(install_dir_path, tool_name, tool_version) - if os.path.isdir(path_tool): - eprint(f"\033[0;31;47m WARNING:" + path_tool + " already exist! \033[0m") - eprint(f"\033[0;31;47m WARNING: file(s) inside will be overwritten \033[0m") - else: - eprint(f"\033[0;37;46m LOG: Create install folder at: " + path_tool + "\033[0m") - os.makedirs(path_tool) - return path_tool - - -def conda_tool(params, args): - eprint(f"\033[0;37;46m LOG: Conda installation detected \033[0m") - tool_name = args.tool_name - tool_version = args.tool_version - install_conda = params['conda_envs_path'] - install_dir = params['install_dir_path'] - path_tool = os.path.join(install_dir, tool_name, tool_version) - env_tool = tool_name + '-' + tool_version - path_env = os.path.join(install_conda, env_tool) - if not os.path.isdir(path_env): - eprint(f"\033[0;31;47m ERROR:" + path_env + " do not exist! \033[0m") - eprint(f"\033[0;31;47m ERROR: Was conda environment has been created? \033[0m") - eprint(f"\033[0;31;47m ERROR: Processus killed \033[0m") - exit(1) - - env_sh = open(os.path.join(path_tool, 'env.sh'), 'w') - env_sh.write('#!/usr/bin/env bash\n') - env_sh.write('. ' + params['anaconda_profile_d'] + '\n') - env_sh.write('conda activate ' + path_env + '\n') - env_sh.close() - delenv_sh = open(os.path.join(path_tool, 'delenv.sh'), 'w') - delenv_sh.write('#!/usr/bin/env bash\n') - delenv_sh.write('conda deactivate\n') - delenv_sh.write('PATH=$(echo "$PATH" | sed -e "s@' + params['anaconda_dir_path'] + '.*/condabin:@@g")\n') - delenv_sh.write('unset CONDA_EXE CONDA_PYTHON_EXE\n') - delenv_sh.close() - eprint(f"\033[0;37;46m LOG: Create env.sh and delenv.sh \033[0m") \ No newline at end of file diff --git a/tooldir b/tooldir index 336e2ca..3667c78 100755 --- a/tooldir +++ b/tooldir @@ -4,7 +4,6 @@ import argparse import sys import os from lib import core as cl -from lib import ifremer as ifr class ToolDir(object): @@ -58,17 +57,6 @@ class ToolDir(object): args = parser.parse_args(sys.argv[2:]) - # IFREMER - params = { - "install_dir_path": "/appli/bioinfo/", - "conda_envs_path": "/appli/conda-env/bioinfo", - "anaconda_dir_path": "/appli/anaconda/versions/", - "anaconda_profile_d": "/appli/anaconda/latest/etc/profile.d/conda.sh" - } - if args.environment == 'conda': - ifr.make_tool_dir(params, args) - ifr.conda_tool(params, args) - # ALL cl.check_path(args) properties = os.path.join(args.path, args.name, 'properties.json') if os.path.isfile(properties):