guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: python: Honor 'GUIX_PYTHON_X_Y_SITE_PACKAGES'.


From: 宋文武
Subject: Re: [PATCH] gnu: python: Honor 'GUIX_PYTHON_X_Y_SITE_PACKAGES'.
Date: Sun, 18 Mar 2018 08:04:00 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hartmut Goebel <address@hidden> writes:

> Am 17.03.2018 um 12:18 schrieb 宋文武:
>
>  I plan to implement option 1 by adding a "sitecustomize.py" (better
> than modify "site.py") into the python packages, and modify
> "search-path-specification" to use "GUIX_PYTHON_X_Y_SITE_PACKAGES".
>
> Sorry, do say, but does not work in a virtual environment, since 
> GUIX_PYTHON_X_Y_SITE_PACKAGES will be added unconditionally. Also I assume 
> this will execute site.main
> () twice.

Okay, and maybe it actually works?  :-)

It turns out that 'sitecustomize.py' will be imported (executed) at most
once, and won't be added unconditionally:

- with "include-system-site-packages = false", a python3 created venv
  will have a "sys.path" like:

  ['',
  '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python36.zip',
  '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6',
  
'/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/lib-dynload',
  '/tmp/venv36/lib/python3.6/site-packages']

  Since "sitecustomize.py" is in
  
"/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/site-packages",
  it's not executed at all.


- with "include-system-site-packages = true", the python3 created venv
  will have a "sys.path" like:

  ['',
  '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python36.zip',
  '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6',
  
'/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/lib-dynload',
  '/tmp/lib/python3.6/site-packages',
  
'/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/site-packages',
  ...... (entries added by GUIX_PYTHON_3_6_SITE_PACKAGES)]

  I think this is the wanted result.

  I haven't try "virtualenv" and python2 (need time to build...), but
  I guess the results should be the same?
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]