forked from conda/conda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deactivate
executable file
·40 lines (36 loc) · 971 Bytes
/
deactivate
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
36
37
38
39
40
#!/bin/bash
# Ensure that this script is sourced, not executed
# Note that if the script was executed, we're running inside bash!
if [[ -n $BASH_VERSION ]] && [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
"$(dirname $0)/conda" ..deactivate -h
exit 1
fi
# Determine the directory containing this script
if [[ -n $BASH_VERSION ]]; then
_SCRIPT_LOCATION=${BASH_SOURCE[0]}
elif [[ -n $ZSH_VERSION ]]; then
_SCRIPT_LOCATION=${funcstack[1]}
else
echo "Only bash and zsh are supported"
return 1
fi
_THIS_DIR=$(dirname "$_SCRIPT_LOCATION")
_NEW_PATH=$("$_THIS_DIR/conda" ..activateroot "$@")
if (( $? == 0 )); then
export PATH=$_NEW_PATH
unset CONDA_DEFAULT_ENV
if (( $($_THIS_DIR/conda ..changeps1) )); then
PS1=$CONDA_OLD_PS1
unset CONDA_OLD_PS1
fi
else
return $?
fi
if [[ -n $BASH_VERSION ]]; then
hash -r
elif [[ -n $ZSH_VERSION ]]; then
rehash
else
echo "Only bash and zsh are supported"
return 1
fi