[Distutils] virtualenv3

Barry Warsaw barry at python.org
Sat May 7 00:06:01 CEST 2011


On May 06, 2011, at 04:43 PM, Carl Meyer wrote:

>I don't quite understand this. On my Ubuntu system, with either Ubuntu's
>Python 2.6 or my compiled 3.2, sys.path[0] appears to always be the
>empty string, never the actual full path of the script's directory. How
>is it ever == '/usr/share/pyshared' for you?

Even in the subprocess, i.e. when the Popen.subprocess() re-invokes
sys.executable with the full path to the virtualenv.py file?

>I was going to say that for a slightly less Debian-specific form of
>paranoia, could we only delete sys.path[0] if its in fact the empty
>string? But there seems to be something I'm still missing.

See above.  It makes sense too, given how Python initializes sys.path.  I
think the extra paranoia (whether Debian-specific or not) probably isn't
necessary.  sys.path[0] just isn't needed.

>> Another suggestion given was to put virtualenv.py in a private directory,
>> i.e. not in Debian's equivalent of site-packages.  I don't know whether there
>> are other packages that try to import virtualenv.py though, so to be safe, I
>> just went with the sys.path hacking.
>
>Yes, there is code out there that imports virtualenv and uses it
>programmatically, and this is supported, so breaking it would be bad.

Great to know, thanks!

>Modulo my confusion about how your patch actually works, it seems like a
>reasonable approach to me, and I'd consider applying a
>non-Debian-specific version of the patch to virtualenv.

Cool.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20110506/f4e5b3c5/attachment.pgp>


More information about the Distutils-SIG mailing list