-
Notifications
You must be signed in to change notification settings - Fork 106
Add new hooks #73
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
Add new hooks #73
Conversation
scripts/workon.bat
Outdated
|
|
||
| if defined VIRTUAL_ENV ( | ||
| call "%VIRTUAL_ENV%\Scripts\deactivate.bat" | ||
| if exist "%VIRTUAL_ENV%\Scripts\postdeactivate.bat" ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deactivate.bat clears %VIRTUAL_ENV%, so this works by taking advantage of DOS's rather special variable expansion rules. It might be clearer if the postdeactivate.bat path was saved before the call ... deactivate.bat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, done
| ) | ||
| ) | ||
|
|
||
| if exist "%WORKON_HOME%\%VENV%\Scripts\postactivate.bat" ( |
There was a problem hiding this comment.
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 "local" post-activate/deactivate hooks. #64 implements the global postactivate hook (only). I would prefer a more comprehensive hook implementation PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the global versions of these hooks, following #64 but including a global post-deactivate
… unsets `VIRTUAL_ENV`
… by virtualenvwrapper)
* upstream/master: upversion debug leftover Typo fix in CHANGELOG.rst Getting ready for next release.. Publish the vwenv.bat script. It's starting to be a lot of setup that needs to be done, and it's copied into most scripts with varying levels of fidelity. This is an attempt to collect these into one file, and also to make the work in davidmarble#95 easier to implement. Push 1.2.4 to PyPI. Fix workon, rmvirtualenv, and mkvirtualenv -a when virtualenv and/or project contain spaces. This fixes davidmarble#89. Remove debug echo. Fix 3 failing tests (test-code issues). "Number" headers in CHANGELOG similar to README (the files are concatenated and must match). Updates to add2virtualenv to fix davidmarble#93. Tests for add2virtualenv and setprojectdir. Convert tabs to spaces, fix som issues with spaces in paths, and exit with a distinct error level for each error. Make sure we call cleanup, even on a successful run, and set ERRORLEVEL to zero. Missing return from error_msg. Add support for -h, --help switches, and fix davidmarble#92. Add support for -h --help options, and fix davidmarble#92. tests for mkproject Add publishing step that checks syntax of the reStructuredText in README.rst. updated mkproject to follow coding style of mkvirtualenv. updated readme and changelog as requested. New commands need to be installed.. Add virtualenvwrapper.bat command: Print a list of commands and their descriptions as basic help output. (The linux version has it: https://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html#virtualenvwrapper) Added top-comment and usage block to whereis.bat Changed some awkward verbiage in README.rst Missed a goto:eof.. Fix a number of issues with spaces in virtualenv names in rmvirtualenv.bat and simplified the removal algorithm. Allow spaces in virtualenv names. Start next version. Added mkproject script (with better default PROJECT_HOME) to setup.py upversion Added invoke tasks.py file. ignore PyCharm files Grab fix for path with env-var issue from @nakedmin2017 (nakedmind2017@de4ada2) virtualenv doesn't need an equal sign for parameters with double dashes, fixes davidmarble#86. Fix for davidmarble#85. Fix other potential dir-with-spaces problems. Test for davidmarble#85 Add -k option to run_tests.bat for running single tests. Fix (?) PyPI barfing on readme. Bump Version Release notes for v1.2.2 Implement -a, -i, and -r options to mkvirtualenv. This is a little bit of a hefty rewrite, but it's needed to be able to handle some options, and let other options through to virtualenv. Start of test-suite.
|
Hi @davidfraser thanks for looking into this problem. I've started working on complete support of all hooks, in the hookimpl branch. The implementation mirrors the linux hook implementation in that the hooks are called from a common One of the problems I've ran into is that the The linux version of virtualenvwrapper solves this by stashing away the original deactivate function and overriding it with a wrapper (https://bitbucket.org/virtualenvwrapper/virtualenvwrapper/src/36b8050a90192a087d1060f32083249d13d8a215/virtualenvwrapper.sh?at=master&fileviewer=file-view-default#virtualenvwrapper.sh-770). The solution for us is probably going to be similarly invasive, either we inject our code into the existing Besides the problem of messing with files that don't belong to us, we also need to come up with a solution for existing virtualenvs, since we don't want to require that users re-create their virtualenvs after upgrading Maybe requiring a call to a new function/command (e.g. |
|
That looks a lot more comprehensive, nice to have all the hooks implemented! I think your solution of needing to run |
|
Closing this as your branch supercedes it |
|
I am confused, is this pull request not being accepted? Am I supposed to pull from the other repo instead? Seems like features that should be added. |
|
@natehawkboss check this branch for the current work on this https://github.com/davidmarble/virtualenvwrapper-win/tree/hookimpl Read my comment about deactivate.bat above for the current issue (rewriting files that other packages install are generally not a good idea, and this package is used a lot so any problems would be severe)... |
This adds the ability to create
postactivate.batandpostdeactivate.bathooks in each virtual environment, analogous to thepostactivateandpostdeactivatesupported byvirtualenvwrapperThis is equivalent to #64 but also supports postdeactivate - see #43