Larry Hastings <la...@hastings.org> added the comment: Thanks for your battle-tested feedback, Mr. Bicking! I reply inline.
> The biggest problem is that the environmental variable is inherited by > subprocesses. [...] Another problem is that scripts aren't really > sticky with respect to the environment. [...] > These are real-world problems I encountered with workingenv, and > virtualenv has resolved them very reliably by instead using > sys.executable to select the environment. Excellent points. PYTHONPREFIXES is not a virtualization cure-all; for a complete solution you clearly need an executable file for folks to hang their hat on. However: wouldn't PYTHONPREFIXES greatly simplify virtualenv? All you should need is an executable and a "sitecustomize" module. Your executable would set PYTHONPREFIXES as makes sense and run Python. Your usercustomize would: * set sys.executable, * set sys.prefix (and maybe sys.exec_prefix), * *unset* PYTHONPREFIXES, and * run the user's real sitecustomize if present. If this works reliably it would obviate most of the work virtualenv currently has to do. In fact I just tried this. A two-line shell script for "python3", a twenty-line "sitecustomize.py", installed lib/python3.1/config/Makefile and include/python3.1 in my virtualized environment, and I was able to install HeapDict for python3 using its setup.py. (PyPI lies, though; HeapDict doesn't work unmodified in python3. It calls callable(). But once I fixed that it ran fine.) So it passes a smoke-test at least. > Also, it's hard to mix and match environments in this system. How so? I thought this proposal made it far easier to mix and match environments. PYTHONPREFIXES is a stack; push and pop environments as you like. > Also with respect to the patch, for consistency there needs to be > changes to distutils to make use of this variable. PYTHONUSERBASE > included changes so that you can install based on that variable. Good call. I found it infuriating that setuptools didn't (still doesn't iirc) understand PYTHONUSERBASE, and would complain that the --prefix directory doesn't support .pth files. If this patch goes further I'll fix up distutils. Thanks again for your feedback! ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5819> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com