[Nix-dev] nix store: hardlink vs symlink

Rok Garbas rok.garbas at gmail.com
Sun Sep 25 13:50:49 CEST 2011


On 24/09/11 17:15, Peter Simons wrote:
> Hi Florian,
> 
>  > If ./bin/python is a symlink, python will resolve it to find its home
>  > and set sys.prefix accordingly.
> 
> it seems to me like Python is behaving perfectly reasonable. The prefix of
> Python is at /nix/store/vzpvrymynp4n93bznxha6hadj0ww68vx-python-2.7.1. The
> other paths, /tmp/cfl/bad or /tmp/cfl/good1, are not its prefix.
> 
> Why would you want Python to believe that its prefix would be at one of those
> paths?


1. site module takes sys.prefix to determine where modules are located
"It starts by constructing up to four directories from a head and a tail
part. For the head part, it uses sys.prefix and sys.exec_prefix; empty
heads are skipped. For the tail part, it uses the empty string and then
lib/site-packages (on Windows) or lib/python|version|/site-packages and
then lib/site-python (on Unix and Macintosh). For each of the distinct
head-tail combinations, it sees if it refers to an existing directory,
and if so, adds it to sys.path and also inspects the newly added path
for configuration files." -> http://docs.python.org/library/site.html

2. PYTHONHOME can be used to manipulate sys.prefix and sys.exec_prefix
"When PYTHONHOME is set to a single directory, its value replaces both
prefix and exec_prefix. To specify different values for these, set
PYTHONHOME to prefix:exec_prefix." ->
http://docs.python.org/using/cmdline.html#environment-variables


setting PYTHONHOME looks for me pretty easy and streith forward
solution. another would be that we would copy python interpreter to
profile in a way virtualenv is doing but i believe this is not in the
spirit of nix. also virtualenv is also doing this some other reasons
which don't apply here in nix.

i've tested Florian's pythonhomeWrapper and i can finally use python as
i would with other systems.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 945 bytes
Desc: OpenPGP digital signature
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20110925/655b110a/attachment.bin 


More information about the nix-dev mailing list