From patchwork Thu Jun 19 07:58:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 43204 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E672127BC4A; Thu, 19 Jun 2025 09:00:36 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 82AF727BC49 for ; Thu, 19 Jun 2025 09:00:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSAC8-0008Qd-0e; Thu, 19 Jun 2025 04:00:24 -0400 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 1uSABt-0008Hp-FI for guix-patches@gnu.org; Thu, 19 Jun 2025 04:00:11 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uSABs-0008U3-AP for guix-patches@gnu.org; Thu, 19 Jun 2025 04:00:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=FpHH9bej1UoWDAjq4WBTKfIYh7Hu4/a/SKL1E19KvaM=; b=WHRSUmbeCAiQFxrax0XQtDggnO1PhEqhewpjlkUI7oc4Y597vODS3GMAfHL76a0/M/on8AU4KXqryV7pZRSZciPLPnRr6RhzeOakU881zLRVJsVwx/KrpeCaRGjw9MGTHUSanq6qtV51/1t7p/PUwCLEgMbphq6jlOM9dF5zrZX5Pq2F4eakQNiHTbgbuD4lMZhXXRmVzQsZPtYIzh/smpWEn0EjAdO+sa4GGwNUGuI49ZyxNE53cwSSbREpQ7pqaMFs4Gq4kXv7crc3HhtNQL90gJejDiVKTadkfHK7HWZZGsIKdyVvnhHPabnK9gua/zpA0nigWDOYzPLvNmHKew==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uSABs-0006vh-0U for guix-patches@gnu.org; Thu, 19 Jun 2025 04:00:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78828] [PATCH 1/8] build-system/pyproject: Use copy-recursively instead of merge-dirs. References: <20250618183531.6518-1-ngraves@ngraves.fr> In-Reply-To: <20250618183531.6518-1-ngraves@ngraves.fr> Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 19 Jun 2025 08:00:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78828 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78828@debbugs.gnu.org Cc: Nicolas Graves Received: via spool by 78828-submit@debbugs.gnu.org id=B78828.175031996626229 (code B ref 78828); Thu, 19 Jun 2025 08:00:07 +0000 Received: (at 78828) by debbugs.gnu.org; 19 Jun 2025 07:59:26 +0000 Received: from localhost ([127.0.0.1]:60328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uSABA-0006of-9U for submit@debbugs.gnu.org; Thu, 19 Jun 2025 03:59:26 -0400 Received: from 9.mo562.mail-out.ovh.net ([46.105.72.114]:55539) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uSAAq-0006kt-79 for 78828@debbugs.gnu.org; Thu, 19 Jun 2025 03:59:11 -0400 Received: from director4.derp.mail-out.ovh.net (director4.derp.mail-out.ovh.net [79.137.60.37]) by mo562.mail-out.ovh.net (Postfix) with ESMTPS id 4bNCft0yVCz1j1N; Thu, 19 Jun 2025 07:59:02 +0000 (UTC) Received: from director4.derp.mail-out.ovh.net (director4.derp.mail-out.ovh.net. [127.0.0.1]) by director4.derp.mail-out.ovh.net (inspect_sender_mail_agent) with SMTP for <78828@debbugs.gnu.org>; Thu, 19 Jun 2025 07:59:01 +0000 (UTC) Received: from mta11.priv.ovhmail-u1.ea.mail.ovh.net (unknown [10.109.231.2]) by director4.derp.mail-out.ovh.net (Postfix) with ESMTPS id 4bNCfs5RwKz1yY8; Thu, 19 Jun 2025 07:59:01 +0000 (UTC) Received: from ngraves.fr (unknown [10.1.6.3]) by mta11.priv.ovhmail-u1.ea.mail.ovh.net (Postfix) with ESMTPSA id 59735263C9E; Thu, 19 Jun 2025 07:59:01 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-97G002c795ed2d-2c49-46b0-86cc-ccb7e3660df8, 129058C0FBD5227E7F6EF83700C8F3C5E5DC00BA) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 80.215.169.212 Date: Thu, 19 Jun 2025 09:58:47 +0200 Message-ID: <20250619075859.10878-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 14070652614750298850 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgdegleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeetveehffevvdfgtddthedvhfeguefggeffteetueeliedvhffhjeegudehleegheenucfkphepuddvjedrtddrtddruddpkedtrddvudehrdduieelrddvuddvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejkeekvdekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdfovfetjfhoshhtpehmohehiedvmgdpmhhouggvpehsmhhtphhouhht DKIM-Signature: a=rsa-sha256; bh=FpHH9bej1UoWDAjq4WBTKfIYh7Hu4/a/SKL1E19KvaM=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1750319942; v=1; b=s76RRA3f0TF0HcUmY8UYSLxKOJEyksptc5499arfuXmPgE1Mv0KSNVrIUzZ6zLQwxAB6Pnoi PUUok9Uje3TJ0FHD1kkZKOdXbwXjP1ytm7qa190OXfkM5ZLJqaFivvOFhMglAICFc07+FhzXSat gFmJ9zWFYB+o1ZqRg1nALgP2mtLuS73iJUHiWiH+vrP3FIlwE0tM71UwvR4xbyE2sXuwmE1mWVw joV0Xts5Rm+XtN+7lYJQ4bhVnhwkqbKrGOFJ/IYBDW8pyEfNpXEb3t9XyNdyn3O9dl28/O8Nejg EFKKo3trdA2IWVxE9hPem0HEhAl4lhrEcuSdtduCI62KA== 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: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Using rename-file, the destination had to be empty otherwise it would error out. This has been fixed by the use of copy-recursively, really merging them. Changing this makes merge-directories mostly a duplicate of copy-recursively, thus fully switch to copy-recursively. * guix/build/pyproject-build-system.scm (install) : Remove it, used only once. : Remove it, replace its calls by copy-recursively and delete-file-recursively. --- guix/build/pyproject-build-system.scm | 51 ++++++++------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm index 97fd4862f0..1b66dce99c 100644 --- a/guix/build/pyproject-build-system.scm +++ b/guix/build/pyproject-build-system.scm @@ -193,30 +193,6 @@ (define (extract file) ;; Use Python’s zipfile to avoid extra dependency (invoke "python" "-m" "zipfile" "-e" file site-dir)) - (define python-hashbang - (string-append "#!" python "/bin/python")) - - (define* (merge-directories source destination - #:optional (post-move #f)) - "Move all files in SOURCE into DESTINATION, merging the two directories." - (format #t "Merging directory ~a into ~a~%" source destination) - (for-each (lambda (file) - (format #t "~a/~a -> ~a/~a~%" - source file destination file) - (mkdir-p destination) - ;; Use 'copy-recursively' rather than 'rename-file' to guard - ;; against the odd case where DESTINATION is a non-empty - ;; directory, which may happen when using hybrid Python - ;; build systems. - (copy-recursively (string-append source "/" file) - (string-append destination "/" file)) - (delete-file-recursively (string-append source "/" file)) - (when post-move - (post-move file))) - (scandir source - (negate (cut member <> '("." ".."))))) - (rmdir source)) - (define (expand-data-directory directory) "Move files from all .data subdirectories to their respective\ndestinations." ;; Python’s distutils.command.install defines this mapping from source to @@ -224,29 +200,32 @@ (define (expand-data-directory directory) (let ((source (string-append directory "/scripts")) (destination (string-append out "/bin"))) (when (file-exists? source) - (merge-directories source destination - (lambda (f) - (let ((dest-path (string-append destination - "/" f))) - (chmod dest-path #o755) - ;; PEP 427 recommends that installers rewrite - ;; this odd shebang. - (substitute* dest-path - (("#!python") - python-hashbang))))))) + (copy-recursively source destination) + (delete-file-recursively source) + (for-each + (lambda (file) + (chmod file #o755) + ;; PEP 427 recommends that installers rewrite + ;; this odd shebang. + (substitute* file + (("#!python") + (string-append "#!" python "/bin/python")))) + (find-files destination)))) ;; Data can be contained in arbitrary directory structures. Most ;; commonly it is used for share/. (let ((source (string-append directory "/data")) (destination out)) (when (file-exists? source) - (merge-directories source destination))) + (copy-recursively source destination) + (delete-file-recursively source))) (let* ((distribution (car (string-split (basename directory) #\-))) (source (string-append directory "/headers")) (destination (string-append out "/include/python" (python-version python) "/" distribution))) (when (file-exists? source) - (merge-directories source destination)))) + (copy-recursively source destination) + (delete-file-recursively source)))) (define (list-directories base predicate) ;; Cannot use find-files here, because it’s recursive.