[Distutils] new zc.buildout and virtualenv no longer friends?

Carl Meyer carl at oddbird.net
Fri Apr 30 22:34:42 CEST 2010


Hi Gary,

Gary Poster wrote:
> 1. virtualenv fixes the -S flag.  I doubt the virtualenv maintainers
> care, but if they did, that would be great.

Ian can correct if I'm wrong, but AFAIK that would be quite difficult.
Virtualenv is built around a custom site.py; that's where all the magic
happens. Without site.py all you've got is a relocated Python binary
with a bare-bones mini-stdlib. You could place a complete copy of the
stdlib inside each virtualenv; I think any other solution would involve
re-creating virtualenv from the ground up.

There are some interesting alternative approaches for doing virtualenvs,
such as http://github.com/kvbik/rvirtualenv/; but that one also depends
on site.py. I'm not aware of any that don't.

> 2. zc.buildout and bootstrap special case virtualenv: if virtualenv
> is sniffed (handwave...), we don't use -S.  This is messy, but it
> means that virtualenv users get what they want without fuss, and
> non-virtualenv users can use a system Python without fuss.

FWIW, sniffing for virtualenv is quite easy (no hand-waving required!)
Just check for hasattr(sys, 'real_prefix'). Pip uses this, so it's
already depended on outside virtualenv.

Carl


More information about the Distutils-SIG mailing list