bug-guix
[Top][All Lists]
Advanced

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

bug#25235: [PATCH 1/1] build-system/pyproject: Do not wrap native-inputs


From: Ludovic Courtès
Subject: bug#25235: [PATCH 1/1] build-system/pyproject: Do not wrap native-inputs.
Date: Tue, 17 Jan 2023 10:28:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> Fixes <https://issues.guix.gnu.org/25235>.
>
> * guix/build/pyproject-build-system.scm (wrap) [native-inputs]: New argument.
> Filter out native inputs from the values in GUIX_PYTHONPATH.

Yay, great to see this fixed!

>  guix/build/pyproject-build-system.scm | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/guix/build/pyproject-build-system.scm 
> b/guix/build/pyproject-build-system.scm
> index a66c1fb34a..cd418f7ec9 100644
> --- a/guix/build/pyproject-build-system.scm
> +++ b/guix/build/pyproject-build-system.scm
> @@ -445,7 +445,7 @@ (define* (add-install-to-pythonpath #:key native-inputs 
> outputs
>    "A phase that just wraps the 'add-installed-pythonpath' procedure."
>    (add-installed-pythonpath native-inputs outputs))
>  
> -(define* (wrap #:key inputs outputs #:allow-other-keys)
> +(define* (wrap #:key native-inputs inputs outputs #:allow-other-keys)
>    (define (list-of-files dir)
>      (find-files dir (lambda (file stat)
>                        (and (eq? 'regular (stat:type stat))
> @@ -464,9 +464,17 @@ (define bindirs
>    (define %guile (delay (search-input-file inputs "bin/guile")))
>    (define (guile) (force %guile))
>  
> -  (let* ((var `("GUIX_PYTHONPATH" prefix
> -                ,(search-path-as-string->list
> -                  (or (getenv "GUIX_PYTHONPATH") "")))))
> +  ;; Use the same strategy to compute the native-input file names.
> +  (define %native-input-dirs (delay (match native-inputs
> +                                      (((_ . dir) ...)
> +                                       dir))))
> +  (define (native-input-dirs) (force %native-input-dirs))
> +
> +  (let ((var `("GUIX_PYTHONPATH" prefix
> +               ,(remove (lambda (x)
> +                          (any (cut string-prefix? <> x) 
> (native-input-dirs)))
> +                        (search-path-as-string->list
> +                         (or (getenv "GUIX_PYTHONPATH") ""))))))

I think there’s no need to delay+thunk things since we’re using them
right away.  How about:

  (define native-input-directories
    (match native-inputs
      …))

  (let ((var `("GUIX_PYTHONPATH" prefix
               ,(remove (lambda (x) … native-input-directories …) …))))
    …)

?

(Same for ‘%guile’ above, but I don’t see it in ‘master’; maybe that’s
from another branch?)

Thanks,
Ludo’.





reply via email to

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