[Distutils] pythonv, take two

Carl Meyer carl at oddbird.net
Thu Mar 31 07:52:17 CEST 2011



On 03/30/2011 11:23 PM, P.J. Eby wrote:
> At 01:35 PM 3/30/2011 -0400, Carl Meyer wrote:
>> So... it seems to me that we're likely to break _some_ third-party code
>> using sys.prefix regardless of what we do here. My instinct says adding
>> sys.virtual_prefix and leaving sys.prefix alone is the better approach,
>> but I'm not very firmly entrenched in that position.
> 
> Looking at it from a software distribution POV, I would say that the
> virtual prefix is what it should point to, since that means things won't
> get installed to the wrong place.

Indeed. The issue is that from every point of view other than software
distribution (code trying to find anything other than site-directories),
sys.prefix pointing to the virtualenv is wrong. Unless, like virtualenv,
we try to make it "just right enough" by copying/symlinking things into
the virtualenv that otherwise wouldn't need to be there.

But this may be moot; I didn't realize until I checked just now that
setuptools (well, easy_install) builds its own list of site-dirs based
on sys.prefix. It doesn't look like that's used for installation, but it
is used for pre-flight checking pth-capability and finding pth files. So
if easy_install directly relies on site-directories always being
sys.prefix-based, that probably forces the issue.

> (Of course, a configuration option could be used to override it, if
> really necessary.)

This seems like the worst option of all - then third-party code really
would have no idea at all what sys.prefix is supposed to mean, or what
can be reliably found there.

Carl


More information about the Distutils-SIG mailing list