guix-devel
[Top][All Lists]
Advanced

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

Re: 03/163: build/python: Add a new guix-pythonpath procedure.


From: Ludovic Courtès
Subject: Re: 03/163: build/python: Add a new guix-pythonpath procedure.
Date: Mon, 25 Jan 2021 22:46:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi!

guix-commits@gnu.org skribis:

> apteryx pushed a commit to branch cu/farewell-to-pythonpath
> in repository guix.

Woow!

> commit c3c5bdd2b0ea4588ecba424fdbf6df101d967d3d
> Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> AuthorDate: Fri Jan 22 09:34:33 2021 -0500
>
>     build/python: Add a new guix-pythonpath procedure.
>     
>     This procedure will be used in place where the static "PYTHONPATH" string 
> used
>     to be.
>     
>     * guix/build/python-build-system.scm (guix-pythonpath): New procedure.

[...]

> +(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.

(I didn’t follow the PYTHONPATH discussion so apologies if this comment
is off!)

Anyhow, thanks for this long awaited change!

Ludo’.



reply via email to

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