[Python-Dev] Proposal for virtualenv functionality in Python

P.J. Eby pje at telecommunity.com
Sat Feb 20 21:31:35 CET 2010

At 02:41 PM 2/20/2010 -0500, Ian Bicking wrote:
>Virtualenv uses copies when it can't use symlinks. Â A copy (or hard 
>link) seems appropriate on systems that do not have symlinks. Â It 
>would seem reasonable that on Windows it might look in the registry 
>to find the actual location where Python was installed. Â Or... 
>whatever technique Windows people think is best; it's simply 
>necessary that the interpreter know its location (the isolated 
>environment) and also know where Python is installed. Â All this 
>needs to be calculated in C, as the standard library needs to be on 
>the path very early (so os.symlink wouldn't help, but any C-level 
>function to determine this would be helpful).

The ways pretty much boil down to:

1. Explicit per-instance configuration (either appended to the .exe 
or in a file adjacent to it),

2. An implicit global search/lookup (PATH, registry, etc.)

3. A combination of the two, checking explicit configuration before implicit.

Since the virtualenv itself may need some kind of nearby 
configuration anyway, putting it in that file seems to me like the 
One Obvious Way To Do It.

Windows does have C-level APIs for reading and writing .ini files, 
from the good old days before the registry existed.  And the C-level 
code might only need to read one entry prior to booting Python anyway 
- a single call to the GetPrivateProfileString function, once you've 
determined the name of the file to be read from.

More information about the Python-Dev mailing list