Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Virtualenv defines an alias for the command deactivate as seen in yourvirtualenv/bin/activate.csh. What I'm curious about is where deactivate resides, because when I issue an alias command deactivate does not appear in the list of active aliases.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Assuming that you're actually running bash rather than csh, the script you want to look at is yourvirtualenv/bin/activate (not yourvirtualenv/bin/activate.csh), which defines a function called deactivate, not an alias. You can see this with the type command:

$ type deactivate
deactivate is a function
deactivate () 
{ 
    typeset env_postdeactivate_hook;
    typeset old_env;
    virtualenvwrapper_run_hook "pre_deactivate";
    env_postdeactivate_hook="$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/postdeactivate";
    old_env=$(basename "$VIRTUAL_ENV");
    virtualenv_deactivate $1;
    virtualenvwrapper_run_hook "post_deactivate" "$old_env";
    if [ ! "$1" = "nondestructive" ]; then
        unset -f virtualenv_deactivate > /dev/null 2>&1;
        unset -f deactivate > /dev/null 2>&1;
    fi
}
share|improve this answer
    
I saw the function definition as well, but did not know how it related to the alias in the .csh file. Thanks a lot! Had no idea that you could define functions in this manner, as well as type out their definitions. –  Parham Oct 24 '13 at 15:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.