GNU bug report logs - #60868
[PATCH] build: pyproject-build-system: Use wrap-script instead of wrap-program.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Keywords: patch; dated Mon, 16 Jan 2023 20:38:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 60868 <at> debbugs.gnu.org:


Received: (at 60868) by debbugs.gnu.org; 17 Jan 2023 15:52:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 17 10:52:21 2023
Received: from localhost ([127.0.0.1]:38013 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHoG5-00063K-A5
	for submit <at> debbugs.gnu.org; Tue, 17 Jan 2023 10:52:21 -0500
Received: from mail-qt1-f172.google.com ([209.85.160.172]:37668)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pHoG3-000634-CL
 for 60868 <at> debbugs.gnu.org; Tue, 17 Jan 2023 10:52:19 -0500
Received: by mail-qt1-f172.google.com with SMTP id j9so4727863qtv.4
 for <60868 <at> debbugs.gnu.org>; Tue, 17 Jan 2023 07:52:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=vQph+U78wM7gswDtCtC5sFWvDDgodFlWzTXt5s4aRHM=;
 b=hYbiF03cug4KiCrOxdL28fblVGe3sQmTh/jb3DSXpGItKNuH/3OVPKnmp0Ec2SMQxq
 jIOEuDbptDuBMRMU/q1pIVv0jYGU7uedjAo5z4Uz71Ew0DQYbTfVlgitbnBCqPsVD0Ak
 cYm+hDTyXv8FbbmSc7DgRzyl4ugjOcDlqB36GVMzeXA2jttzNIUwtTRER0ZOSA12tXdF
 hZtZNrYzQ0FhOpS0T087HjwqChUxHvCZUmQTfYlmEN52oE1t/+N5V+FEhB9OMvau8RMG
 VrtB6qm5iSVGmUqyj76xc/6OaHjxaxHmFuswXOJtBlbYXb0uIngQmUucb+bwpGAZAgX8
 7P5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=vQph+U78wM7gswDtCtC5sFWvDDgodFlWzTXt5s4aRHM=;
 b=AdUfj60a2cKUnTQUjumMH9HORhp/rMp/CFFNZY44vTKDON9hGvVGuMuaGCy703Vy3Z
 0CuO5pbPDz7WF8UvwuGUiZVJGuzEgyFPEbsGLW0dv5sInlL9yp/7nVPS/FabtOckyCtY
 NB4APw531B9eV4g+1LDUELiARqlVq8e5w23X5jQ1wgl2fwXiXOdBlo4w3RV+qn/9hrZf
 sQuDZeOrLWVIrUZqFsmOQtst8eJeQbS65YBc59mr/F8tGpbOI5fJ1D9I+UgqKCTzmWSj
 uf9W8FuoVilbK/0bkcbZTA3YObfFuxqzzQYlX6c6Mc1PqGJhabKhwe/P9QmcYJunXm+P
 7VaA==
X-Gm-Message-State: AFqh2krcFjazxYpwttGfGLCAZhpuIgknemETIGbqEjyI+ye8/ZlVDpyt
 dimF3J7/FMouYzptPaZY45q8e7hnFPPpVUB4
X-Google-Smtp-Source: AMrXdXvNxAXjEcyPqxLd4oY+x0m1UyF/Gf9PrHfjrHYA1QiO7J45pyYrRkv6OPiY5zCw0VbJAVyJHQ==
X-Received: by 2002:ac8:540a:0:b0:3b6:461e:afec with SMTP id
 b10-20020ac8540a000000b003b6461eafecmr308978qtq.31.1673970734112; 
 Tue, 17 Jan 2023 07:52:14 -0800 (PST)
Received: from hurd (dsl-205-233-125-107.b2b2c.ca. [205.233.125.107])
 by smtp.gmail.com with ESMTPSA id
 t13-20020ac8760d000000b003b63187dbe1sm3027167qtq.27.2023.01.17.07.52.13
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 17 Jan 2023 07:52:13 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60868 <at> debbugs.gnu.org
Subject: Re: bug#60868: [PATCH] build: pyproject-build-system: Use
 wrap-script instead of wrap-program.
References: <20230116203711.2214-1-maxim.cournoyer@HIDDEN>
Date: Tue, 17 Jan 2023 10:52:12 -0500
In-Reply-To: <20230116203711.2214-1-maxim.cournoyer@HIDDEN> (Maxim
 Cournoyer's message of "Mon, 16 Jan 2023 15:37:11 -0500")
Message-ID: <87zgah17mb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60868
Cc: Lars-Dominik Braun <lars@HIDDEN>, jgart <jgart@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

Just a note to mention that this is currently based on #60849 (I've just
marked it as such in Debbugs by making it blocked by it), so if you want
to apply it, you'll want to apply #60849 first.

-- 
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#60868; Package guix-patches. Full text available.
Added blocking bug(s) 60849 Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Jan 2023 20:37:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 16 15:37:38 2023
Received: from localhost ([127.0.0.1]:34944 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHWEc-0000kX-2w
	for submit <at> debbugs.gnu.org; Mon, 16 Jan 2023 15:37:38 -0500
Received: from lists.gnu.org ([209.51.188.17]:35068)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pHWEY-0000kN-Tc
 for submit <at> debbugs.gnu.org; Mon, 16 Jan 2023 15:37:36 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1pHWEX-0007k1-5m
 for guix-patches@HIDDEN; Mon, 16 Jan 2023 15:37:33 -0500
Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1pHWES-0004B3-9x
 for guix-patches@HIDDEN; Mon, 16 Jan 2023 15:37:30 -0500
Received: by mail-qt1-x82f.google.com with SMTP id j9so2830021qtv.4
 for <guix-patches@HIDDEN>; Mon, 16 Jan 2023 12:37:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=tN3kCXvG1iYzSRadl4JQRWi6/dAIl4QrxTwLxEUiL6o=;
 b=qeO7asI4TGY3HyowVYt30TvO8pv3cc4DbME1crQYrGezz+7M8YduhhZQQwnReBaOzP
 1eDKyGZXFqBu04aLqKlA202Klgcv+xLVTCr+4IJI2t7u82t4t5S1FWFjKSC8m7cve0qC
 XKXcz/yYg/YA6McPlHpvlQ9LnSYRV5QlGA5XRx8hBE8oeZvwAhbe2JKSETnuqMKcXbFY
 K5aWty6I32oWTKOnw2XZqdvxRWvQd5s+Mfx5hkAYTx3RUzZBs31DEFFg3Vg8d/83dsLf
 XtVFYSFotetpALSxpN1Qr0AYRD6FyuNnXXJGBrMv4yVNrD1oidr4E1d0C83HYojNgxw/
 sMQg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=tN3kCXvG1iYzSRadl4JQRWi6/dAIl4QrxTwLxEUiL6o=;
 b=CxlebQH8ICL8FWk4FYL9T3nAWeNowQF2Ml5zx7BN0wU7zOeHHGVbVtfRYi+uqMpvQq
 NOVy7+EpSR9fNXFnsLcsDcs5F1NVl9gFK21d+PF2rN84cbwnx2TclXOAgefLH3hUW751
 Qy8vZtkdmZhyQ9Y3jBCWPYi302TFXtbzUo13JgjmO0kYJ0+n+ajIXH5IY/RRtlgy857h
 vsmviHJXSzFDkpRuMqr9r349bTQxHVfanRT0L4uLsuJ6yDnfX8t+nuXLOVgNsdo9rzax
 bQq1tPAi7GGigTQaKSOucwfZeDdVjpsDiojcMaoawhA51u7VIeXqqNb54NCuW9neb8gc
 nMtA==
X-Gm-Message-State: AFqh2kqKXfX997exPsyjT4bidB6Ul6C98XgV7COZzrixykdLWHiC0p5y
 KR6Ja365zzC4I1Tt3xB8FnAPrvm5PoHQHJ5Y
X-Google-Smtp-Source: AMrXdXtkH57DDGvbBziCyOMg0Nw49Qr43alg2H7VUO5PnD52aeq+3SJB3EqTKXxpxj4sWfXrNhtkjg==
X-Received: by 2002:a05:622a:22a6:b0:3b6:2b4b:5688 with SMTP id
 ay38-20020a05622a22a600b003b62b4b5688mr616211qtb.11.1673901447142; 
 Mon, 16 Jan 2023 12:37:27 -0800 (PST)
Received: from localhost.localdomain (dsl-10-130-209.b2b2c.ca. [72.10.130.209])
 by smtp.gmail.com with ESMTPSA id
 fd7-20020a05622a4d0700b003a5fb681ae7sm15126262qtb.3.2023.01.16.12.37.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 16 Jan 2023 12:37:26 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] build: pyproject-build-system: Use wrap-script instead of
 wrap-program.
Date: Mon, 16 Jan 2023 15:37:11 -0500
Message-Id: <20230116203711.2214-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::82f;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-qt1-x82f.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: jgart <jgart@HIDDEN>, Lars-Dominik Braun <lars@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

* guix/build-system/pyproject.scm (default-guile): New procedure.
(lower) Add guile to the host-inputs of the bag.
* guix/build/pyproject-build-system.scm (wrap): Replace wrap-program with
wrap-script.  Rename bash-related nested variables/procedure with
guile-related ones.
---

 guix/build-system/pyproject.scm       |  9 +++++++-
 guix/build/pyproject-build-system.scm | 30 ++++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm
index 74d739023f..8b5091c654 100644
--- a/guix/build-system/pyproject.scm
+++ b/guix/build-system/pyproject.scm
@@ -59,6 +59,12 @@ (define (default-python)
   (let ((python (resolve-interface '(gnu packages python))))
     (module-ref python 'python-toolchain)))
 
+(define (default-guile)
+  "Return the default Guile used to wrap Python scripts."
+  ;; Lazily resolve the binding to avoid a circular dependency.
+  (let ((guile (resolve-interface '(gnu packages guile))))
+    (module-ref guile 'guile-3.0)))
+
 (define sanity-check.py
   ;; TODO: Merge with sanity-check.py in the next rebuild cycle.
   (search-auxiliary-file "python/sanity-check-next.py"))
@@ -88,7 +94,8 @@ (define private-keywords
                           '())
                     ;; Keep the standard inputs of 'gnu-build-system'.
                     ,@(standard-packages)))
-    (host-inputs inputs)
+    (host-inputs (modify-inputs inputs
+                   (append (default-guile))))
     (target-inputs (if target
                        (standard-cross-packages target 'target)
                        '()))
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index e51b5cfc43..a66c1fb34a 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -445,9 +445,33 @@ (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 native-inputs outputs #:allow-other-keys #:rest args)
-  (apply (assoc-ref python:%standard-phases 'wrap)
-         (append args (list #:inputs native-inputs))))
+(define* (wrap #:key inputs outputs #:allow-other-keys)
+  (define (list-of-files dir)
+    (find-files dir (lambda (file stat)
+                      (and (eq? 'regular (stat:type stat))
+                           (not (wrapped-program? file))))))
+
+  (define bindirs
+    (append-map (match-lambda
+                  ((_ . dir)
+                   (list (string-append dir "/bin")
+                         (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)))
 
 (define* (rename-pth-file #:key name native-inputs outputs #:allow-other-keys
                           #:rest args)

base-commit: 6c2d3eb8aef45381961ad4e8cf0d03ccbf2bbd64
-- 
2.38.1





Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#60868; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 17 Jan 2023 16:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.