From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: 03/163: build/python: Add a new guix-pythonpath procedure.
Date: Thu, 28 Jan 2021 15:16:24 +0100 [thread overview]
Message-ID: <87lfcdm9jb.fsf@gnu.org> (raw)
In-Reply-To: <878s8g3bxa.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 25 Jan 2021 17:10:41 -0500")
Hi Maxim,
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>> +(define (guix-pythonpath inputs)
>>> + "Derive the GUIX_PYTHONPATH_X_Y string , with the major and minor version
>>> +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 ‘GUIX_LOCPATH’, is to still keep
>> a single environment variable (that’d be ‘GUIX_PYTHONPATH’ 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’d have just GUIX_PYTHONPATH but Python 3.8 would only care about
>> 3.8/ sub-directories while 2.7 would only care about 2.7/
>> sub-directories.
>>
>> That’s perhaps easier to document and to deal with generally (you only
>> need to look at one specific environment variable).
>>
>> Does that make sense? I don’t know if it’s applicable in 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’m advocating for a versioned environment variable too, but I’m
suggesting that versioning should not be part of the variable name.
In the ‘GUIX_LOCPATH’ 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 ‘glibc-versioned-locpath.patch’.
If possible, the proposed ‘GUIX_PYTHONPATH’ variable could work
similarly: “/MAJOR.MINOR” would automatically be appended to each search
path entry.
That way, both Python 2.7 and 3.8 can populate the same ‘GUIX_LOCPATH’
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’.
next prev parent reply other threads:[~2021-01-28 14:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210125070022.22870.17321@vcs0.savannah.gnu.org>
[not found] ` <20210125070114.03C0B20E1C@vcs0.savannah.gnu.org>
2021-01-25 21:46 ` 03/163: build/python: Add a new guix-pythonpath procedure Ludovic Courtès
2021-01-25 22:10 ` Maxim Cournoyer
2021-01-28 14:16 ` Ludovic Courtès [this message]
2021-01-29 14:25 ` Maxim Cournoyer
2021-02-01 15:37 ` Ludovic Courtès
2021-02-05 10:26 ` Hartmut Goebel
2021-02-26 15:36 ` Maxim Cournoyer
2021-03-07 11:13 ` Hartmut Goebel
2021-03-14 0:58 ` Maxim Cournoyer
2021-03-27 10:47 ` Hartmut Goebel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lfcdm9jb.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guix-devel@gnu.org \
--cc=maxim.cournoyer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).