From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cAwyM7a1xWMUowAAbAwnHQ (envelope-from ) for ; Mon, 16 Jan 2023 21:38:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WBTeMra1xWNMUAAAauVa8A (envelope-from ) for ; Mon, 16 Jan 2023 21:38:14 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 60BC28A1D for ; Mon, 16 Jan 2023 21:38:14 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHWF2-0008Er-5Y; Mon, 16 Jan 2023 15:38:04 -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 ) id 1pHWF1-0008Eg-7P for guix-patches@gnu.org; Mon, 16 Jan 2023 15:38:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHWF0-0004Fm-NP for guix-patches@gnu.org; Mon, 16 Jan 2023 15:38:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHWF0-0000lC-J7 for guix-patches@gnu.org; Mon, 16 Jan 2023 15:38:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60868] [PATCH] build: pyproject-build-system: Use wrap-script instead of wrap-program. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 16 Jan 2023 20:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60868 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60868@debbugs.gnu.org Cc: jgart , Lars-Dominik Braun , Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16739014582889 (code B ref -1); Mon, 16 Jan 2023 20:38:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Jan 2023 20:37:38 +0000 Received: from localhost ([127.0.0.1]:34944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHWEc-0000kX-2w for submit@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 ) id 1pHWEY-0000kN-Tc for submit@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 ) id 1pHWEX-0007k1-5m for guix-patches@gnu.org; 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 ) id 1pHWES-0004B3-9x for guix-patches@gnu.org; Mon, 16 Jan 2023 15:37:30 -0500 Received: by mail-qt1-x82f.google.com with SMTP id j9so2830021qtv.4 for ; 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 Date: Mon, 16 Jan 2023 15:37:11 -0500 Message-Id: <20230116203711.2214-1-maxim.cournoyer@gmail.com> 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@gmail.com; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673901494; a=rsa-sha256; cv=none; b=E4ylKi3g23X5CDJLR1ASZGDN1QlBCWtnRfvmLeBUUGVaeeM+kx4gFIr0StRsRvqLg8lkhT FvtDn65+1zfJbNAd/iMOWQ1JSqvi3VN1w/+x8/BCGShWk6SSfXqNGYimBGz9KqxU7IOVBk A634xc4AmGzeAvEuS4VUwF5lqklC15Zi863s7qAx6ko2aBO9Nt76lSpHCmbHvEgN199muK u6H4dcPmlQzj3HZK0jQ8FMX4rAbxwdZRU/LwU0rAYTYmFnUyRhPq/TZWKniD4DPRoIKa0U Q62QLLBtknS5UY2+D83qNwiio/OGL0IKKpzfGkGnI0sz0Je4zoIXrKqCDdgLiQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=qeO7asI4; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673901494; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=tN3kCXvG1iYzSRadl4JQRWi6/dAIl4QrxTwLxEUiL6o=; b=l84lx9rFt+4MFa5pLSR3gowQsmT93QXwvNtyRNyJMfRTrmnqYympEotZedLWQ3ksyKIEcf kZqAh5s+u9NCw1B4tuEPYTmwbRvwjb0nNrWu8+pGEdS9j5+hzJF/gFajiXNFex9RtEJM8P uraLKc4+KtlaakRMqHiZh8uPoB7LjpLWf0hrDcNGqOVAxHVYLi4leXplBss9ya5d8+bAN6 1y2/HotaVKA8vQ+6AuhljALr/KcP3yZIq4ZgmtbYqoS7+LJfnAdZQi2ZRKbG/m+OxwVMqz FQH4tgZOR7WCzIHU+MPkGXViUAgYDDwVFUBsqIXH+FRJwvBWe+KU8jYystzDkw== X-Migadu-Spam-Score: 1.27 X-Spam-Score: 1.27 X-Migadu-Queue-Id: 60BC28A1D X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=qeO7asI4; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) X-TUID: 8xsbQpquZLa7 * 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