Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run a postactivate hook when workon is called -- related to #43 #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Convenience Commands

Hooks
----------
To run some commands after ``mkvirtualenv`` you can use hooks. First you need to define ``VIRTUALENVWRAPPER_HOOK_DIR`` variable. If it is set ``mkvirtualenv`` will run ``postmkvirtualenv.bat`` script from that directory.
To run some commands after ``mkvirtualenv`` you can use hooks. First you need to define ``VIRTUALENVWRAPPER_HOOK_DIR`` variable. If it is set ``mkvirtualenv`` will run ``postmkvirtualenv.bat`` script and ``workon`` will run ``postactivate.bat`` script from that directory.
9 changes: 9 additions & 0 deletions scripts/workon.bat
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,13 @@ if exist "%WORKON_HOME%\%VENV%\%VIRTUALENVWRAPPER_PROJECT_FILENAME%" (
)
)

REM Run postactivate.bat
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mother-project implements both local and global post-activate/deactivate hooks. This code implements the implements the global postactivate hook (only), while #73 implements the "local" post-activate/deactivate hooks. I would prefer a more comprehensive hook implementation PR...


if defined VIRTUALENVWRAPPER_HOOK_DIR (
if exist "%VIRTUALENVWRAPPER_HOOK_DIR%\postactivate.bat" (
call "%VIRTUALENVWRAPPER_HOOK_DIR%\postactivate.bat"
)
)


:END