mirror of
https://github.com/YunoHost-Apps/synapse_ynh.git
synced 2024-09-03 20:26:38 +02:00
Update activate file
This commit is contained in:
parent
ee8e3b9545
commit
1fea4e5c83
1 changed files with 26 additions and 28 deletions
|
@ -2,17 +2,14 @@
|
||||||
# you cannot run it directly
|
# you cannot run it directly
|
||||||
|
|
||||||
deactivate () {
|
deactivate () {
|
||||||
unset -f pydoc >/dev/null 2>&1
|
|
||||||
|
|
||||||
# reset old environment variables
|
# reset old environment variables
|
||||||
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
|
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||||
if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then
|
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||||
PATH="$_OLD_VIRTUAL_PATH"
|
|
||||||
export PATH
|
export PATH
|
||||||
unset _OLD_VIRTUAL_PATH
|
unset _OLD_VIRTUAL_PATH
|
||||||
fi
|
fi
|
||||||
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
|
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||||
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
|
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||||
export PYTHONHOME
|
export PYTHONHOME
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME
|
unset _OLD_VIRTUAL_PYTHONHOME
|
||||||
fi
|
fi
|
||||||
|
@ -20,18 +17,18 @@ deactivate () {
|
||||||
# This should detect bash and zsh, which have a hash command that must
|
# This should detect bash and zsh, which have a hash command that must
|
||||||
# be called to get it to forget past commands. Without forgetting
|
# be called to get it to forget past commands. Without forgetting
|
||||||
# past commands the $PATH changes we made may not be respected
|
# past commands the $PATH changes we made may not be respected
|
||||||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
|
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||||
hash -r 2>/dev/null
|
hash -r
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
|
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||||
PS1="$_OLD_VIRTUAL_PS1"
|
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||||
export PS1
|
export PS1
|
||||||
unset _OLD_VIRTUAL_PS1
|
unset _OLD_VIRTUAL_PS1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset VIRTUAL_ENV
|
unset VIRTUAL_ENV
|
||||||
if [ ! "${1-}" = "nondestructive" ] ; then
|
if [ ! "$1" = "nondestructive" ] ; then
|
||||||
# Self destruct!
|
# Self destruct!
|
||||||
unset -f deactivate
|
unset -f deactivate
|
||||||
fi
|
fi
|
||||||
|
@ -48,31 +45,32 @@ PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
# unset PYTHONHOME if set
|
# unset PYTHONHOME if set
|
||||||
if ! [ -z "${PYTHONHOME+_}" ] ; then
|
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||||
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
|
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||||
|
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||||
|
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||||
unset PYTHONHOME
|
unset PYTHONHOME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
|
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||||
_OLD_VIRTUAL_PS1="$PS1"
|
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||||
if [ "x" != x ] ; then
|
if [ "x(new) " != x ] ; then
|
||||||
PS1="$PS1"
|
PS1="(new) ${PS1:-}"
|
||||||
else
|
else
|
||||||
PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
|
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
|
||||||
|
# special case for Aspen magic directories
|
||||||
|
# see http://www.zetadev.com/software/aspen/
|
||||||
|
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
|
||||||
|
else
|
||||||
|
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
export PS1
|
export PS1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure to unalias pydoc if it's already there
|
|
||||||
alias pydoc 2>/dev/null >/dev/null && unalias pydoc
|
|
||||||
|
|
||||||
pydoc () {
|
|
||||||
python -m pydoc "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# This should detect bash and zsh, which have a hash command that must
|
# This should detect bash and zsh, which have a hash command that must
|
||||||
# be called to get it to forget past commands. Without forgetting
|
# be called to get it to forget past commands. Without forgetting
|
||||||
# past commands the $PATH changes we made may not be respected
|
# past commands the $PATH changes we made may not be respected
|
||||||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
|
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||||
hash -r 2>/dev/null
|
hash -r
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue