Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 189eaa10 authored by Kostis ANAGNOSTOPOULOS's avatar Kostis ANAGNOSTOPOULOS
Browse files

enh(setup) dump homed-paths for conda-env >

for tips to always be fuctional.
parent 00f64c4c
Branches
Tags
No related merge requests found
......@@ -26,9 +26,10 @@ mydir=$(realpath "${0%/*}")
cd "$mydir"
function _short {
## Return vars relative to PWD, prefixed with "./"
# as conda env needs
local path=$(realpath -m --relative-base="$PWD" "$1")
## Return vars relative to some base(default: PWD),
# prefixed with "./", as `conda activate <prefix>` needs it.
local base="${2:-$PWD}"
local path=$(realpath -m --relative-base="$base" "$1")
## Does result start with alpha-chars (eg dirname)?.
if [[ "/." != *"${path::1}"* ]]; then
echo "./$path"
......@@ -37,11 +38,24 @@ function _short {
fi
}
function _homed {
## Return vars relative to home-dir,
# prefixed with "~/", as `conda activate <prefix>` needs it.
local path=$(realpath -m --relative-base="$PWD" "$1")
## Does result start with alpha-chars (eg dirname)?.
if [[ "/." != *"${path::1}"* ]]; then
echo "~/$path"
else
echo "$path"
fi
}
function _join {
echo $*
}
conda_env_prefix=$(_short "$mydir/env")
conda_env_prefix_homed=$(_homed "$mydir/env")
function _mute {
"${@}" &> /dev/null
......@@ -354,9 +368,9 @@ function upd50_create_conda_env {
local check_file="$conda_env_prefix"
local running_msg="should take ~5min to create a conda-env@$conda_env_prefix..."
local notrun_msg="already created;
DELETE it with 'conda env remove $conda_env_prefix' and re-run, to effect change.
DELETE it with 'conda env remove $conda_env_prefix_homed' and re-run, to effect change.
Reminder for how to (re-)activate your environment: conda activate $conda_env_prefix"
Reminder for how to (re-)activate your environment: conda activate $conda_env_prefix_homed"
if _exists_before_update "$check_file"; then
conda env create -p "$conda_env_prefix" -f environment.yml
fi
......@@ -388,7 +402,7 @@ unset _UDS_OLD_PATH
unset _UDS_OLD_PYTHONPATH
EOF
echo "UPDATED
RE-ACTIVATE YOUR ENVIRONMENT with: conda activate $conda_env_prefix"
RE-ACTIVATE YOUR ENVIRONMENT with: conda activate $conda_env_prefix_homed"
fi
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment