Author larry
Recipients ianb, larry
Date 2009-04-23.23:39:42
SpamBayes Score 2.67009e-14
Marked as misclassified No
Message-id <1240529984.86.0.215882810607.issue5819@psf.upfronthosting.co.za>
In-reply-to
Content
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!
History
Date User Action Args
2009-04-23 23:39:45larrysetrecipients: + larry, ianb
2009-04-23 23:39:44larrysetmessageid: <1240529984.86.0.215882810607.issue5819@psf.upfronthosting.co.za>
2009-04-23 23:39:43larrylinkissue5819 messages
2009-04-23 23:39:42larrycreate