1. Doug Hellmann
  2. virtualenvwrapper


Doug Hellmann  committed 9d60aba Merge

merge ChrisHas35's postactivatehook changes

  • Participants
  • Parent commits 46f4ea7, 1cc216f
  • Branches master

Comments (0)

Files changed (3)


View file
  • Ignore whitespace
 be used to disable or clear settings in your environment. ``$VIRTUAL_ENV`` refers to the old
 environment at the time the script runs.
+The global ``postactivate`` script is sourced after the new environment is enabled and the new
+environment's postactivate is sourced (if it exists). ``$VIRTUAL_ENV`` refers to the new
+environment at the time the script runs.
+This example script adds a space between the virtual environment name and your old PS1 by making
+use of ``_OLD_VIRTUAL_PS1``.
+    PS1="(`basename \"$VIRTUAL_ENV\"`) $_OLD_VIRTUAL_PS1"
   - Pull in fix for colorized ls from Jeff Forcier (b42a25f7b74a).
+  - Add global postactivate hook.
   - Add more hooks for operations to run before and after creating or deleting environments based on changes from Chris Hasenpflug.

File test.sh

View file
  • Ignore whitespace
 mk_test_hook postmkvirtualenv
 mk_test_hook prermvirtualenv
 mk_test_hook postrmvirtualenv
+mk_test_hook postactivate
 echo "HOOKS:"

File virtualenvwrapper_bashrc

View file
  • Ignore whitespace
     source "$activate"
     virtualenvwrapper_source_hook "$VIRTUAL_ENV/bin/postactivate"
+    virtualenvwrapper_source_hook "$WORKON_HOME/postactivate"
 	return 0