From mboxrd@z Thu Jan 1 00:00:00 1970 From: iyzsong@member.fsf.org (=?utf-8?B?5a6L5paH5q2m?=) Subject: Re: [PATCH] gnu: python: Honor 'GUIX_PYTHON_X_Y_SITE_PACKAGES'. Date: Sun, 18 Mar 2018 08:04:00 +0800 Message-ID: <87woyauu4v.fsf@member.fsf.org> References: <87371tqbyb.fsf@elephly.net> <20180223165953.GA6088@thebird.nl> <40dc2378-a039-fec8-55cd-23911f1642ab@crazy-compilers.com> <87lgerwk9s.fsf@member.fsf.org> <874llfvtl6.fsf_-_@member.fsf.org> <93100715-0198-f210-3b2c-856af462151a@crazy-compilers.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exLo7-0001U7-BN for guix-devel@gnu.org; Sat, 17 Mar 2018 20:04:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exLo4-000606-5n for guix-devel@gnu.org; Sat, 17 Mar 2018 20:04:15 -0400 Received: from rezeros.cc ([45.76.207.221]:46006) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1exLo3-0005v8-Lu for guix-devel@gnu.org; Sat, 17 Mar 2018 20:04:12 -0400 In-Reply-To: <93100715-0198-f210-3b2c-856af462151a@crazy-compilers.com> (Hartmut Goebel's message of "Sat, 17 Mar 2018 22:53:33 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Hartmut Goebel Cc: guix-devel@gnu.org Hartmut Goebel writes: > Am 17.03.2018 um 12:18 schrieb =E5=AE=8B=E6=96=87=E6=AD=A6: > > 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_PYT= HON_X_Y_SITE_PACKAGES will be added unconditionally. Also I assume this wil= l 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 =3D false", a python3 created venv will have a "sys.path" like: ['', '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python36.zi= p', '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6', '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/l= ib-dynload', '/tmp/venv36/lib/python3.6/site-packages'] Since "sitecustomize.py" is in "/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/s= ite-packages", it's not executed at all. - with "include-system-site-packages =3D true", the python3 created venv will have a "sys.path" like: ['', '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python36.zi= p', '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6', '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/l= ib-dynload', '/tmp/lib/python3.6/site-packages', '/gnu/store/pppycfhs5gc7dsx7g099l9p6ncw3m6d9-python-3.6.4/lib/python3.6/s= ite-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? =20=20