forked from mamba-org/micromamba-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_activate_current_env.sh
executable file
·35 lines (28 loc) · 1.02 KB
/
_activate_current_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# This script should never be called directly, only sourced:
# source _activate_current_env.sh
# shellcheck shell=bash
# Initialize Micromamba for the current shell
eval "$("${MAMBA_EXE}" shell hook --shell=bash)"
# Attempt to initialize Conda (might not be installed)
__conda_setup="$('conda' 'shell.bash' 'hook' 2> /dev/null)" || true
if [ -n "${__conda_setup}" ]; then
eval "$__conda_setup"
else
if [ -f "${MAMBA_ROOT_PREFIX}/etc/profile.d/conda.sh" ]; then
# shellcheck disable=SC1091
. "${MAMBA_ROOT_PREFIX}/etc/profile.d/conda.sh"
fi
fi
unset __conda_setup
# Attempt to initialize Mamba (might not be installed)
if [ -f "${MAMBA_ROOT_PREFIX}/etc/profile.d/mamba.sh" ]; then
# shellcheck disable=SC1091
. "${MAMBA_ROOT_PREFIX}/etc/profile.d/mamba.sh"
fi
if [[ "${MAMBA_SKIP_ACTIVATE}" == "1" ]]; then
return
fi
# For robustness, try all possible activate commands.
conda activate "${ENV_NAME}" 2>/dev/null \
|| mamba activate "${ENV_NAME}" 2>/dev/null \
|| micromamba activate "${ENV_NAME}"