From: Nicolas Graves via Bug reports for GNU Guix <bug-guix@gnu.org>
To: Lars-Dominik Braun <lars@6xq.net>, Ricardo Wurmus <rekado@elephly.net>
Cc: 25235@debbugs.gnu.org
Subject: bug#25235: [Maxim Cournoyer] bug#25235: [PATCH v3 1/1] build-system/pyproject: Do not wrap native-inputs.
Date: Wed, 01 May 2024 11:36:50 +0200 [thread overview]
Message-ID: <874jbheuvh.fsf@ngraves.fr> (raw)
In-Reply-To: <87eg13birp.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me>
Hi Lars, Ricardo,
I'm advancing with my patch series, which I can submit soon. I was
curious about why this 25235 patch isn't in python-team branch yet since
it's also a very welcome change to the pyproject-build-system.
Cheers,
Nicolas
-------------------- Start of forwarded message --------------------
Subject: bug#25235: [PATCH v3 1/1] build-system/pyproject: Do not wrap
native-inputs.
To: 25235@debbugs.gnu.org
Cc: arunisaac@systemreboot.net, Maxim Cournoyer <maxim.cournoyer@gmail.com>,
ludo@gnu.org, Lars-Dominik Braun <lars@6xq.net>, efraim@flashner.co.il,
rekado@elephly.net, jgart <jgart@dismail.de>, marius@gnu.org
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 23 Jan 2023 08:34:33 -0500
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.
---
Changes in v3:
- Rebase
Changes in v2:
- Add missing copyright line
- Rework wrap phase to avoid removing inputs found in both native-inputs and inputs
- Enclose wrap computations in an 'unless' form and streamline
guix/build/pyproject-build-system.scm | 39 ++++++++++++++++-----------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index a66c1fb34a..9da86bfc54 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -445,7 +446,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))
@@ -458,20 +459,28 @@ (define bindirs
(string-append dir "/sbin"))))
outputs))
- ;; Do not require "guile" to be present in the package inputs
- ;; even when there is nothing to wrap.
- ;; Also, calculate (guile) only once to prevent some I/O.
- (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") "")))))
- (for-each (lambda (dir)
- (let ((files (list-of-files dir)))
- (for-each (cut wrap-script <> #:guile (guile) var)
- files)))
- bindirs)))
+ (unless (null? bindirs)
+ (let* ((guile (search-input-file inputs "bin/guile"))
+ (native-input-dirs (match native-inputs
+ (((_ . dir) ...)
+ dir)))
+ (input-dirs (match inputs
+ (((_ . dir) ...)
+ dir)))
+ (build-inputs (lset-difference string=? native-input-dirs
+ input-dirs))
+ ;; A build input is an input listed in native-inputs and NOT in
+ ;; inputs.
+ (build-input? (lambda (x)
+ (any (cut string-prefix? <> x) build-inputs)))
+ (var `("GUIX_PYTHONPATH" prefix
+ ,(remove build-input? (search-path-as-string->list
+ (or (getenv "GUIX_PYTHONPATH") ""))))))
+ (for-each (lambda (dir)
+ (let ((files (list-of-files dir)))
+ (for-each (cut wrap-script <> #:guile guile var)
+ files)))
+ bindirs))))
(define* (rename-pth-file #:key name native-inputs outputs #:allow-other-keys
#:rest args)
--
2.39.1
-------------------- End of forwarded message --------------------
--
Best regards,
Nicolas Graves
next prev parent reply other threads:[~2024-05-01 9:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 23:28 bug#25235: Wrapped python programs get native-inputs in PYTHONPATH Marius Bakke
2016-12-20 14:00 ` Ludovic Courtès
2016-12-26 18:26 ` Leo Famulari
2017-03-29 11:27 ` Arun Isaac
2017-03-30 15:30 ` Ludovic Courtès
2017-03-30 19:07 ` Arun Isaac
2017-04-04 17:02 ` Arun Isaac
2019-02-07 13:22 ` Ricardo Wurmus
2020-04-06 14:49 ` bug#25235: (no subject) Ricardo Wurmus via web
2020-04-09 0:02 ` Arun Isaac
2020-04-21 2:15 ` bug#25235: Wrapped python programs get native-inputs in PYTHONPATH Arun Isaac
2023-01-16 21:29 ` bug#25235: [PATCH 0/1] build-system/pyproject: Do not wrap native-inputs Maxim Cournoyer
2023-01-16 21:29 ` bug#25235: [PATCH 1/1] " Maxim Cournoyer
2023-01-17 9:28 ` Ludovic Courtès
2023-01-17 15:49 ` Maxim Cournoyer
2023-01-18 9:51 ` Efraim Flashner
2023-01-18 13:22 ` Maxim Cournoyer
2023-01-18 13:59 ` bug#25235: [PATCH v2 0/1] " Maxim Cournoyer
2023-01-18 14:00 ` bug#25235: [PATCH v2 1/1] " Maxim Cournoyer
2023-01-23 10:27 ` Ludovic Courtès
2023-01-23 13:38 ` Maxim Cournoyer
2023-01-23 13:34 ` bug#25235: [PATCH v3 0/1] " Maxim Cournoyer
2023-01-23 13:34 ` bug#25235: [PATCH v3 1/1] " Maxim Cournoyer
2024-05-01 9:36 ` Nicolas Graves via Bug reports for GNU Guix [this message]
2024-05-04 8:05 ` bug#25235: [Maxim Cournoyer] " Lars-Dominik Braun
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=874jbheuvh.fsf@ngraves.fr \
--to=bug-guix@gnu.org \
--cc=25235@debbugs.gnu.org \
--cc=lars@6xq.net \
--cc=ngraves@ngraves.fr \
--cc=rekado@elephly.net \
/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).