On Sun, Feb 21, 2010 at 12:32 PM, Larry Hastings <larry@hastings.org> wrote:
The thread discussing Windows suggests that we shouldn't use symlinks there. I'd say either copying or symlinking pythonv should be supported, and on Windows we recommend copying pythonv.exe.* I'd rather ~/env/bin/python be a symlink instead of copying it.
Conversely, headers may be installed in ~/env and not /usr. The compiler should probably look in both places. But IIUC telling the compiler how to do that is only vaguely standardized--Microsoft's CL.EXE doesn't seem to support any environment variable containing an include /path/.* Compiling extensions can be tricky because code may not find headers (because they are installed in /usr, not ~/env/). I think this can be handled better if virtualenv is slightly less intrusive, or distutils is patched, or generally tools are more aware of this layout.
I suspect solving this in a general way is out-of-band for pythonv, but I'm willing to have my mind changed. Certainly pythonv should add its prefix directory to LD_LIBRARY_PATH on Linux.
I'm unexcited by this; I think simpler is better. pythonv should virtualize environments layered on top of python, and should have one obvious predictable behavior. Certainly if it supports a configuration file pythonv should run without it and pick sensible defaults.
Additionally, the binary will look for a configuration file. I'm not sure where this file should go; perhaps directly alongside the binary, or in some location based on sys.prefix.
The configuration file would be a simple set of assignments; some I might imagine:
* Maybe override sys.prefix
* Control if the global site-packages is placed on sys.path
* On some operating systems there are other locations for packages installed with the system packager; probably these should be possible to enable or disable
* Maybe control installations or point to a file like distutils.cfg
What are the use cases where you need these things to be configurable?
Let me propose further about python and pythonv:
* As Antoine suggested, the CPython interpreter should sprout a new
command-line switch, "--prefix", which adds a new prefix directory.
* pythonv's purpose in life is to infer your prefix directory and
run "pythonX.X --prefix <prefixdir> [ all args it got ... ]".
* Should pythonv should be tied to the specific Python executable? If you run install pythonv as "python", should it look for
"python" or explicitly look for the specific Python it shipped
with, like "python3.2"? I suspect the latter though I'm no longer
sure.
I'm one of those folks who'd like to see this be stackable. If we tweak the semantics just a bit I think it works:
* pythonv should inspect its --prefix arguments, as well as passing
them on to the child python process it runs.
* When pythonv wants to run the next python process in line, it
scans the path looking for the pythonX.X interpreter but /ignores/
all the interpreters that are in in a --prefix bin directory it's
already seen.
* python handles multiple --prefix options, and later ones take
precedence over earlier ones.
* What should sys.interpreter be? Explicit is better than implicit:
the first pythonv to run also adds a --interpreter <argv[0]> to
the front of the command-line. Or they could all add it and
python only uses the last one. This is one area where "python" vs
"python3.2" makes things a little complicated.
I'm at PyCon and would be interested in debating / sprinting on this if there's interest.