SEESenv/bin/activate
author amit@thunder
Mon, 12 Apr 2010 15:12:41 +0530
changeset 49 3b5f1341d6c6
parent 3 6cee07c589cb
permissions -rw-r--r--
Some small changes ... bug fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     1
# This file must be used with "source bin/activate" *from bash*
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     2
# you cannot run it directly
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     3
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     4
deactivate () {
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     5
    if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     6
        PATH="$_OLD_VIRTUAL_PATH"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     7
        export PATH
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     8
        unset _OLD_VIRTUAL_PATH
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
     9
    fi
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    10
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    11
    # This should detect bash and zsh, which have a hash command that must
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    12
    # be called to get it to forget past commands.  Without forgetting
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    13
    # past commands the $PATH changes we made may not be respected
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    14
    if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    15
        hash -r
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    16
    fi
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    17
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    18
    if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    19
        PS1="$_OLD_VIRTUAL_PS1"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    20
        export PS1
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    21
        unset _OLD_VIRTUAL_PS1
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    22
    fi
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    23
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    24
    unset VIRTUAL_ENV
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    25
    if [ ! "$1" = "nondestructive" ] ; then
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    26
    # Self destruct!
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    27
        unset -f deactivate
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    28
    fi
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    29
}
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    30
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    31
# unset irrelavent variables
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    32
deactivate nondestructive
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    33
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    34
VIRTUAL_ENV="/home/amit/SEES-hacks/SEESenv"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    35
export VIRTUAL_ENV
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    36
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    37
_OLD_VIRTUAL_PATH="$PATH"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    38
PATH="$VIRTUAL_ENV/bin:$PATH"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    39
export PATH
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    40
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    41
_OLD_VIRTUAL_PS1="$PS1"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    42
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    43
    # special case for Aspen magic directories
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    44
    # see http://www.zetadev.com/software/aspen/
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    45
    PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    46
else
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    47
    PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    48
fi
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    49
export PS1
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    50
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    51
# This should detect bash and zsh, which have a hash command that must
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    52
# be called to get it to forget past commands.  Without forgetting
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    53
# past commands the $PATH changes we made may not be respected
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    54
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    55
    hash -r
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents:
diff changeset
    56
fi