sashahart / vex

Run a command in the named virtualenv.
MIT License
372 stars 26 forks source link

support pydoc #7

Closed sashahart closed 10 years ago

sashahart commented 10 years ago

virtualenv normally breaks pydoc, but restores its functionality using a shell function named pydoc. cf. pypa/virtualenv#149 pypa/virtualenv@4b775b8 pypa/virtualenv#262 pypa/virtualenv#265

Obviously that workaround won't work for anything that isn't a specifically supported shell with an activate script. So if you activate a virtualenv without sourcing bin/activate (e.g. with vex), and you type 'pydoc', it is just as likely to use the pydoc made by the system python (which will confusingly document the modules in the system python, not the activated virtualenv) or else to result in a 'command not found'.

As far as I know, the only way to restore 'pydoc' in virtualenvs is to have an actual script in the virtualenv. --make provides an opportunity to create that script. On most platforms, this is a +x file inside bin/ but it can be a python script with appropriate hashbang. On windows, this has to be in Scripts\ and it has to have an executable extension; without assuming changed settings this can't be a .py file, the most reasonable solution seems to be a .bat file.