From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hartmut Goebel Subject: Re: PYTHONPATH issue explanation Date: Sat, 17 Mar 2018 23:04:26 +0100 Message-ID: <5d65c8d2-e31b-ee1e-2b9a-145913015c7b@crazy-compilers.com> References: <87371tqbyb.fsf@elephly.net> <20180223165953.GA6088@thebird.nl> <40dc2378-a039-fec8-55cd-23911f1642ab@crazy-compilers.com> <87lgerwk9s.fsf@member.fsf.org> 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]:35693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exJwJ-0008Rn-Qb for guix-devel@gnu.org; Sat, 17 Mar 2018 18:04:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exJwE-0002pL-RW for guix-devel@gnu.org; Sat, 17 Mar 2018 18:04:35 -0400 In-Reply-To: <87lgerwk9s.fsf@member.fsf.org> Content-Language: en-US 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: =?UTF-8?B?5a6L5paH5q2m?= Cc: guix-devel@gnu.org Hi, I agree with Ricardo: We first should agree on what we want to implement. I created a pad at [1] for collecting all test-cases and the expected results. Please add you test-cases there. Thanks! [1] https://semestriel.framapad.org/p/guix-python-site-packages-test-case= s Am 17.03.2018 um 02:41 schrieb =E5=AE=8B=E6=96=87=E6=AD=A6: > - "GUIX_PYTHON_X_Y_SITE_PACKAGES" [=E2=80=A6] is necessary for the "bui= ld" environment. For the build environment we could easily work around using PYTHONPATH. Since the build-system is clearly defined and does not interfere with any user-definitions, this is save to do. > - Avoid any environment variable for the "profile" environment. > > We have a union "profile" for all the python packages, so environment > variables can be totally avoided with the help of "venv". [=E2=80=A6] > We only need to make the "profile" > a "venv" for python. For python3, a simple "pyvenv.cfg" file is > enough, for python2 I guess we have to make a union or copy files lik= e > what "virtualenv" does. This would be a very elegant solution. Unfortunately this does not work as shown in part 2 of my analysis, esp. point 4a. > > We could avoid GUIX-PYTHONHOME[23] if we stop resolving the symlink= s > > at the correct point in iteration. > > This is exactly what "venv" does!=20 Unfortunately venv works quite different: system site-packages are always taken from sys.base_exec. See part 3 of my analysis, esp. the "pyvenv.cfg" section. > 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". When implementing this in sitecustomize.py, you will end up re-implementing the complete venv mechanism. When going the GUIX_PYTHON_X_Y_SITE_PACKAGES route, we should look where the best place will be: Maybe site.PREFIXES, maybe site.getsitepackages(), maybe site.venv(). --=20 Regards Hartmut Goebel | Hartmut Goebel | h.goebel@crazy-compilers.com | | www.crazy-compilers.com | compilers which you thought are impossible |