From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id eHTFDK7IEmCiDQAA0tVLHw (envelope-from ) for ; Thu, 28 Jan 2021 14:22:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SBuFCK7IEmDTFwAAB5/wlQ (envelope-from ) for ; Thu, 28 Jan 2021 14:22:38 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E54AD9403AE for ; Thu, 28 Jan 2021 14:22:37 +0000 (UTC) Received: from localhost ([::1]:39722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l58Bw-0002f9-S1 for larch@yhetil.org; Thu, 28 Jan 2021 09:22:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5860-0004L5-MZ for guix-devel@gnu.org; Thu, 28 Jan 2021 09:16:30 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42510) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l585z-0006hk-2r; Thu, 28 Jan 2021 09:16:28 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58160 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l585y-0008Ko-GR; Thu, 28 Jan 2021 09:16:26 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: 03/163: build/python: Add a new guix-pythonpath procedure. References: <20210125070022.22870.17321@vcs0.savannah.gnu.org> <20210125070114.03C0B20E1C@vcs0.savannah.gnu.org> <87czxs3d1i.fsf@gnu.org> <878s8g3bxa.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 =?utf-8?Q?Pluvi=C3=B4se?= an 229 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 28 Jan 2021 15:16:24 +0100 In-Reply-To: <878s8g3bxa.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 25 Jan 2021 17:10:41 -0500") Message-ID: <87lfcdm9jb.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.85 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: E54AD9403AE X-Spam-Score: -2.85 X-Migadu-Scanner: scn0.migadu.com X-TUID: yKYu087t86kC Hi Maxim, Maxim Cournoyer skribis: >>> +(define (guix-pythonpath inputs) >>> + "Derive the GUIX_PYTHONPATH_X_Y string , with the major and minor ve= rsion >>> +numbers substituted for X and Y, respectively." >>> + (let ((python (assoc-ref inputs "python"))) >>> + (string-append "GUIX_PYTHONPATH_" >>> + (string-replace-substring (python-version python) "= ." "_")))) >> >> One pattern used elsewhere, notably for =E2=80=98GUIX_LOCPATH=E2=80=99, = is to still keep >> a single environment variable (that=E2=80=99d be =E2=80=98GUIX_PYTHONPAT= H=E2=80=99 here) but to >> ensure that only MAJOR.MINOR sub-directories are taken into >> consideration. >> >> IOW, instead of having GUIX_PYTHONPATH_3_8 and GUIX_PYTHONPATH_2_7, >> you=E2=80=99d have just GUIX_PYTHONPATH but Python 3.8 would only care a= bout >> 3.8/ sub-directories while 2.7 would only care about 2.7/ >> sub-directories. >> >> That=E2=80=99s perhaps easier to document and to deal with generally (yo= u only >> need to look at one specific environment variable). >> >> Does that make sense? I don=E2=80=99t know if it=E2=80=99s applicable i= n this case >> though. > > One of the limitations lifted by this change is the limitation of > running a single version of Python per profile. As mentioned in past > discussions, it's not trivial ensuring that packages installed won't end > up pulling various versions of Python in a same profile, so it's better > to prepared for it :-). > > Using a non-versioned GUIX_PYTHONPATH would not allow for this, unless > I'm missing something. Sure, I definitely agree. I=E2=80=99m advocating for a versioned environment variable too, but I=E2= =80=99m suggesting that versioning should not be part of the variable name. In the =E2=80=98GUIX_LOCPATH=E2=80=99 example I gave, locale data is looked= up not directly in the search path entries, but instead in those entries prefixed by the libc version. See =E2=80=98glibc-versioned-locpath.patch= =E2=80=99. If possible, the proposed =E2=80=98GUIX_PYTHONPATH=E2=80=99 variable could = work similarly: =E2=80=9C/MAJOR.MINOR=E2=80=9D would automatically be appended t= o each search path entry. That way, both Python 2.7 and 3.8 can populate the same =E2=80=98GUIX_LOCPA= TH=E2=80=99 variable, and eventually 2.7 only picks 2.7 packages and 3.8 only picks 3.8 packages. Does that make more sense? Thanks, Ludo=E2=80=99.