From unknown Tue Jun 17 22:25:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#29856] [PATCH core-updates] guix: python-build-system: Modify ".py" files in-place. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 26 Dec 2017 12:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29856 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 29856@debbugs.gnu.org Cc: Danny Milosavljevic X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15142908825796 (code B ref -1); Tue, 26 Dec 2017 12:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 26 Dec 2017 12:21:22 +0000 Received: from localhost ([127.0.0.1]:52421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eToEU-0001VQ-15 for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eToET-0001VD-2x for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eToEN-0003xW-5R for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55890) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eToEN-0003xQ-2F for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eToEL-0007gF-Tf for guix-patches@gnu.org; Tue, 26 Dec 2017 07:21:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eToEI-0003ug-MP for guix-patches@gnu.org; Tue, 26 Dec 2017 07:21:13 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:40074) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eToEI-0003tg-GD for guix-patches@gnu.org; Tue, 26 Dec 2017 07:21:10 -0500 Received: from dayas.3.home (77.118.177.251.wireless.dyn.drei.com [77.118.177.251]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 3C95E33601CF; Tue, 26 Dec 2017 13:21:08 +0100 (CET) From: Danny Milosavljevic Date: Tue, 26 Dec 2017 13:21:05 +0100 Message-Id: <20171226122105.19156-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.15.1 Tags: patch X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) * guix/build/python-build-system.scm (wrap-python-program): New variable. (wrap-program*): New variable. (wrap): Use wrap-program*. --- guix/build/python-build-system.scm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index dd07986b9..f5f6b07f8 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -25,6 +25,7 @@ #:use-module (guix build utils) #:use-module (ice-9 match) #:use-module (ice-9 ftw) + #:use-module (ice-9 rdelim) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases @@ -184,6 +185,32 @@ when running checks after installing the package." configure-flags))) (call-setuppy "install" params use-setuptools?))) +(define (wrap-python-program file-name vars) + "Wrap the given program as a Python script (in-place)" + (match vars + (("PYTHONPATH" 'prefix python-path) + (let ((pythonish-path (string-join python-path "', '"))) + (with-atomic-file-replacement file-name + (lambda (in out) + (display (format #f "#!~a +import sys +sys.path = ['~a'] + sys.path +" (which "python") pythonish-path) out) + (let loop ((line (read-line in 'concat))) + (if (eof-object? line) + #t + (begin + (display line out) + (loop (read-line in 'concat))))))))))) + +(define (wrap-program* file-name vars) + "Wrap the given program. + If FILE-NAME is ending in '.py', wraps it in a Python way. + Otherwise wraps it in a Bash way." + (if (string-suffix? ".py" file-name) + (wrap-python-program file-name vars) + (wrap-program file-name vars))) + (define* (wrap #:key inputs outputs #:allow-other-keys) (define (list-of-files dir) (map (cut string-append dir "/" <>) @@ -209,7 +236,7 @@ when running checks after installing the package." (or (getenv "PYTHONPATH") "")))))) (for-each (lambda (dir) (let ((files (list-of-files dir))) - (for-each (cut wrap-program <> var) + (for-each (cut wrap-program* <> var) files))) bindirs))) From unknown Tue Jun 17 22:25:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#29856] [PATCH core-updates] guix: python-build-system: Modify ".py" files in-place. Resent-From: Leo Famulari Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 26 Dec 2017 19:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29856 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 29856@debbugs.gnu.org Received: via spool by 29856-submit@debbugs.gnu.org id=B29856.151431541718510 (code B ref 29856); Tue, 26 Dec 2017 19:11:02 +0000 Received: (at 29856) by debbugs.gnu.org; 26 Dec 2017 19:10:17 +0000 Received: from localhost ([127.0.0.1]:52892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTucC-0004oU-UL for submit@debbugs.gnu.org; Tue, 26 Dec 2017 14:10:17 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:46475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTucA-0004oJ-M8 for 29856@debbugs.gnu.org; Tue, 26 Dec 2017 14:10:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8CC2720F6D; Tue, 26 Dec 2017 14:10:14 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 26 Dec 2017 14:10:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= mesmtp; bh=feZoO8LLMsqyTPoT8W4P6tsoKOUeYaI0jzdr94hNRWo=; b=obvFR ReigQtfJJPngp2yMRG5/UnxtpD7wGynySURi3OwFU1M+BTmcHxaPVgam5jku8xGy WMSCeQzrUitoF5x7at4hBbehjmKHW677KWRzmuDrQ9kDUxOoS4Gu90jw4pWlm9Pg rvQ8DPPdsS/pDAU7p0qKbKWCyflTBxrGJ1KdGc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=feZoO8LLMsqyTPoT8W4P6tsoKOUeY aI0jzdr94hNRWo=; b=I+CQIB008GMzP8zcYHBjbOZqau9RoSfozLAcv2pd0WBev 3NcLNgtYLnUDP/jWO2mzP1q+WSFdXaj/F5lsrC1R6jiqvrb0O1Z4HU+Uk/t+cl0p e4mxrBgAy3PL6p8R8V8zCqzVs9zqtViCXjPBY7fLmKgW0yIbjrDBuU2DPZxYLWnr gcfKrX3ckF9WrQrce1jDjO7Met49bwotqmY0lLiQq7Umwj0TEe9Yif6nBkFk6eli I8IboSkgD42GDmW983Zm9xBNB0/pw3cP03cGC0iwQWcouJYqLMT7sQcmz/g0Tfru 988ZycSZb5ev5CG9ISfabI8bxpvskMLxXhl7HJmdg== X-ME-Sender: Received: from localhost (c-76-109-243-109.hsd1.fl.comcast.net [76.109.243.109]) by mail.messagingengine.com (Postfix) with ESMTPA id 42C9124447; Tue, 26 Dec 2017 14:10:14 -0500 (EST) Date: Tue, 26 Dec 2017 14:10:13 -0500 From: Leo Famulari Message-ID: <20171226191013.GE1413@jasmine.lan> References: <20171226122105.19156-1-dannym@scratchpost.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lteA1dqeVaWQ9QQl" Content-Disposition: inline In-Reply-To: <20171226122105.19156-1-dannym@scratchpost.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --lteA1dqeVaWQ9QQl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Dec 26, 2017 at 01:21:05PM +0100, Danny Milosavljevic wrote: > * guix/build/python-build-system.scm (wrap-python-program): New variable. > (wrap-program*): New variable. > (wrap): Use wrap-program*. The idea here is to avoid renaming the Python executables to .foo-real, right? --lteA1dqeVaWQ9QQl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlpCnpUACgkQJkb6MLrK fwh7vw/8C8gRrXHE1ziXAB4mAn2EgJp12DvRXOoS4VUE6UjPp2dC9hd+jqjbEmbq PV2JnGUiCyIz4I5Umk5Vxd3NdsuNeozJSHsWRVMLhsrtq+lBi8mc0XPFkWvPVPhx YVKSHyE/urFwxTu6pyqtmKVRIJWdffWNpPL8iVP7x0OsjC/SgQ3ztfjpbctzLWEJ a4KbSMvwY8PcDKqh+hKLrMC+BgnM86Gadj+dpyDzaI8jhMPaX50z/T6emiGS0JeH ntlgl7zX36JjwBBSR8sczgaYjkAZTM3Vfxwnsdi/Tqil9MHI4DVwCcDfA3VPov5o mnGWX0U+jDghmshe+5RjU/rNoQRHIeM9T9VA8wCyKKDJu25mTMzjOiff8ln2vnJL Tr0nDBUC9OT3XTWVtGbCxVSbbxR+1K4YdimO+qxtynAheqL2VjKTvdZ9dGUwFObO BMuqYYKymPoMjPfqSs35oGUUC9HT4xEtzwTvVIY6rh5y5dV6FVz0zTWngggTrBDr 9YlQxIap8+OoUYMuVakO6rddFzPAE0cYFItuuspriY/7Bxp5lVhmCqbL06jQJQyg 4y76TVFVGQZH/e6QLv3Yz6tx6PWjtoF1Suy+G/ef+5CqKau8qfA8B5RY1E1ErD+r I/rcdaw7YOrY6ujy9YBhZTFPOa+BMH/VYcqWu/gorUQMQLBesLI= =aE4o -----END PGP SIGNATURE----- --lteA1dqeVaWQ9QQl-- From unknown Tue Jun 17 22:25:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#29856] [PATCH core-updates] guix: python-build-system: Modify ".py" files in-place. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 27 Dec 2017 00:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29856 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Leo Famulari Cc: 29856@debbugs.gnu.org Received: via spool by 29856-submit@debbugs.gnu.org id=B29856.151433421222215 (code B ref 29856); Wed, 27 Dec 2017 00:24:02 +0000 Received: (at 29856) by debbugs.gnu.org; 27 Dec 2017 00:23:32 +0000 Received: from localhost ([127.0.0.1]:52997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTzVM-0005mF-68 for submit@debbugs.gnu.org; Tue, 26 Dec 2017 19:23:32 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:36696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTzVK-0005m7-8L for 29856@debbugs.gnu.org; Tue, 26 Dec 2017 19:23:30 -0500 Received: from localhost (77.118.177.251.wireless.dyn.drei.com [77.118.177.251]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 60FA833602A0; Wed, 27 Dec 2017 01:23:28 +0100 (CET) Date: Wed, 27 Dec 2017 01:23:26 +0100 From: Danny Milosavljevic Message-ID: <20171227012326.5aa8a762@scratchpost.org> In-Reply-To: <20171226191013.GE1413@jasmine.lan> References: <20171226122105.19156-1-dannym@scratchpost.org> <20171226191013.GE1413@jasmine.lan> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, 26 Dec 2017 14:10:13 -0500 Leo Famulari wrote: > On Tue, Dec 26, 2017 at 01:21:05PM +0100, Danny Milosavljevic wrote: > > * guix/build/python-build-system.scm (wrap-python-program): New variable. > > (wrap-program*): New variable. > > (wrap): Use wrap-program*. > > The idea here is to avoid renaming the Python executables to .foo-real, > right? Yes, especially since Python itself sometimes imports those and then it's tripping over the bash script when it expected a Python script. From unknown Tue Jun 17 22:25:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#29856] [PATCH core-updates] guix: python-build-system: Modify ".py" files in-place. Resent-From: Marius Bakke Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Dec 2017 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29856 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic , Leo Famulari Cc: 29856@debbugs.gnu.org Received: via spool by 29856-submit@debbugs.gnu.org id=B29856.151473255430772 (code B ref 29856); Sun, 31 Dec 2017 15:03:02 +0000 Received: (at 29856) by debbugs.gnu.org; 31 Dec 2017 15:02:34 +0000 Received: from localhost ([127.0.0.1]:58867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVf8E-00080G-DO for submit@debbugs.gnu.org; Sun, 31 Dec 2017 10:02:34 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:41341) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVf8C-000807-IS for 29856@debbugs.gnu.org; Sun, 31 Dec 2017 10:02:32 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 2F16A21A8A; Sun, 31 Dec 2017 10:02:32 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sun, 31 Dec 2017 10:02:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=0MYYecyk+vU1UacNdqUKrku6ViqgZJZFmkjKyv473bg=; b=yMYjMeBj 1zIGTDyAQRqeO73VAe4LvxA5iHY3h6g4pBXS11vlHWIhBEvA6Y5CLACgtlb9iakS csKJNY+bThsGZ6r7FIohjVxPVapO04w7gwpvwE8TTNVJGhQ242PGMOGZxBWMgBNY hS9156ujHcaofDeBgDChq1XB4HBK58Rp4ZOb+s1LFRR+yUAWG5uGm3INRr56vkd3 lmSm1ELMq+OFofodDyjddOb/YWfS3tx8jrZCXqrU45SdD0TmiOxq7JrQjMPkqyNy MVZwlmKs5qwgakHYyMyNqADitjYxWTcikoyLqYgALWr2vxFslyuGcY4wqpM8TFyf 22LAT9sO2HxqQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=0MYYecyk+vU1UacNdqUKrku6ViqgZ JZFmkjKyv473bg=; b=jtm5EpxbOSbQJhYFI5JCtnXcl0XxBRE8K/ZC+L0M9sEhA 2E1M4jgUdGOH6tAezrVl1hwKQ3pWF80dGt7BbGaZwtyqFnnUJSYeE7Ow80oVzDBn 2Byxo73IgcVvJpfs/b59jUF8Dlh8tn9zR835xAjWnhUp1Wdm7inpLGZtNXnFjt63 p4TKF0w3X4ocMzq4WhltzeuKVwQGfI+rkbeo2lI77sIODMZH3l6UPekzucZa9RLu FUJb91Nb98Y8oD0T9Eullh+AWA3iEzvd01dawewhzm+V0vqQ8DI+eRkipZMmRvLI jJiYtX899BHj1b6TsykjyvNigZnw4e6x92fs9h7Aw== X-ME-Sender: Received: from localhost (cm-84.214.173.174.getinternet.no [84.214.173.174]) by mail.messagingengine.com (Postfix) with ESMTPA id A7CFA7E31F; Sun, 31 Dec 2017 10:02:31 -0500 (EST) From: Marius Bakke In-Reply-To: <20171227012326.5aa8a762@scratchpost.org> References: <20171226122105.19156-1-dannym@scratchpost.org> <20171226191013.GE1413@jasmine.lan> <20171227012326.5aa8a762@scratchpost.org> User-Agent: Notmuch/0.25.3 (https://notmuchmail.org) Emacs/25.3.1 (x86_64-pc-linux-gnu) Date: Sun, 31 Dec 2017 16:02:30 +0100 Message-ID: <87d12vaqk9.fsf@fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Danny Milosavljevic writes: > On Tue, 26 Dec 2017 14:10:13 -0500 > Leo Famulari wrote: > >> On Tue, Dec 26, 2017 at 01:21:05PM +0100, Danny Milosavljevic wrote: >> > * guix/build/python-build-system.scm (wrap-python-program): New variab= le. >> > (wrap-program*): New variable. >> > (wrap): Use wrap-program*.=20=20 >>=20 >> The idea here is to avoid renaming the Python executables to .foo-real, >> right? > > Yes, especially since Python itself sometimes imports those and then it's= tripping over the bash script when it expected a Python script. I wonder if this will fix . "meson" is not installed with a .py extension, but I guess we can call wrap-program* on it. Would it work to peek at the shebang instead of the file extension? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlpI/AYACgkQoqBt8qM6 VPrrHQf+KiR+FFQjWUMT1Klcqz+LzuZehrNcUwxFUeBapTRPn8IlZKo47EMD09Lb v2N6ODeE2F8A4+xX35PrD0dZTTnHNGpSmYoePMO6SyPI0GHq6cAMsXASpWKPQJDy cB3QsN4MG7IBhmIPf22VKESudzuLHBOZmmuG5CLYo6dfFdYhcj6chh6I6wDvqOoc oxcxbfwyjKI058TIFaQb4OYFfam5LkAtKmm5epQ351ttKPpD8e29aOkpV4WpzN6G v7qHClHE3+p/caNSTYAxAKVlUBI1a06poea1imUU6XR6eVpAqdgT+5OgGzT+y+rk Fw8M4naroPxuRkbobfc0qUd8YVmAiw== =unNI -----END PGP SIGNATURE----- --=-=-=-- From unknown Tue Jun 17 22:25:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#29856] [PATCH core-updates] guix: python-build-system: Modify ".py" files in-place. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Dec 2017 17:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29856 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Marius Bakke Cc: 29856@debbugs.gnu.org, Leo Famulari Received: via spool by 29856-submit@debbugs.gnu.org id=B29856.151474068310763 (code B ref 29856); Sun, 31 Dec 2017 17:19:02 +0000 Received: (at 29856) by debbugs.gnu.org; 31 Dec 2017 17:18:03 +0000 Received: from localhost ([127.0.0.1]:58945 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVhFK-0002nX-Td for submit@debbugs.gnu.org; Sun, 31 Dec 2017 12:18:03 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:50188) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVhFI-0002n7-Vh for 29856@debbugs.gnu.org; Sun, 31 Dec 2017 12:18:01 -0500 Received: from localhost (178.113.228.174.wireless.dyn.drei.com [178.113.228.174]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 3E2EA33601F3; Sun, 31 Dec 2017 18:17:59 +0100 (CET) Date: Sun, 31 Dec 2017 18:17:55 +0100 From: Danny Milosavljevic Message-ID: <20171231181755.7fe64e7e@scratchpost.org> In-Reply-To: <87d12vaqk9.fsf@fastmail.com> References: <20171226122105.19156-1-dannym@scratchpost.org> <20171226191013.GE1413@jasmine.lan> <20171227012326.5aa8a762@scratchpost.org> <87d12vaqk9.fsf@fastmail.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hi Marius, On Sun, 31 Dec 2017 16:02:30 +0100 Marius Bakke wrote: > I wonder if this will fix . "meson" is not > installed with a .py extension That bugreport sounds as if the searched-for program is "meson.py". But I tried to install meson while having 29856 applied. Doesn't work. >, but I guess we can call wrap-program* on it. If you made sure the original wrapping thing didn't run, yeah. That's why I did such an intrusive fix in the first place. > Would it work to peek at the shebang instead of the file extension? Probably, but I wanted it to be dead easy for core-updates. Not sure whether, if we examined the content, there would be any false positives, empty files, dangling symlinks, special files etc which would need special handling. Every change there rebuilds for several hours on my machine, so I'd like a sure-to-work block even when testing :) From unknown Tue Jun 17 22:25:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#29856] [PATCH core-updates] guix: python-build-system:, Modify ".py" files in-place. References: <20171226122105.19156-1-dannym@scratchpost.org> In-Reply-To: <20171226122105.19156-1-dannym@scratchpost.org> Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Jan 2018 16:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29856 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 29856@debbugs.gnu.org Cc: Danny Milosavljevic , Marius Bakke Received: via spool by 29856-submit@debbugs.gnu.org id=B29856.15149095993563 (code B ref 29856); Tue, 02 Jan 2018 16:14:02 +0000 Received: (at 29856) by debbugs.gnu.org; 2 Jan 2018 16:13:19 +0000 Received: from localhost ([127.0.0.1]:33316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWPBn-0000vP-Gy for submit@debbugs.gnu.org; Tue, 02 Jan 2018 11:13:19 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:54145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWPBl-0000vH-Up for 29856@debbugs.gnu.org; Tue, 02 Jan 2018 11:13:18 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3z9zcs1cZWz1qrNW; Tue, 2 Jan 2018 17:13:17 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3z9zcs1CvCz26T2C; Tue, 2 Jan 2018 17:13:17 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id HjnbfoKkq_7r; Tue, 2 Jan 2018 17:13:16 +0100 (CET) Received: from hermia.goebel-consult.de (ppp-93-104-162-253.dynamic.mnet-online.de [93.104.162.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Tue, 2 Jan 2018 17:13:16 +0100 (CET) Received: from [192.168.110.2] (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id A83FC607A8; Tue, 2 Jan 2018 17:13:15 +0100 (CET) From: Hartmut Goebel Organization: crazy-compilers.com Message-ID: <86b45cc4-f8ef-95da-87f7-397db19c424e@crazy-compilers.com> Date: Tue, 2 Jan 2018 17:13:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------6A65D42712545950E5BBC99D" Content-Language: en-US X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------6A65D42712545950E5BBC99D Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I'm afraid, this patch will lead to quite some serious problems: * It "kills" the doc-string, which must be the very first expression-statement in the program. This might be rarely used, but * it kills "from __future__ import", which must be the first import statement (or even the first statement after any doc-string) to work.= Fixing these issues would require to implement a language-aware scanner, as discussed in . Thus I suggest aiming to implement the solution discussed in that thread (see esp. . Beside of this, the patch suffers from some more issues. Sorry to say :-(= * When converting PYTHONPATH into a list of python strings, these need to be quoted properly. * The description (commit-message) of the patch is much to terse. It should describe the the reason and implications. Esp. it should describe the case this is fixing. BTW: The first analysis in was misleading. I commented there. --=20 Regards Hartmut Goebel | Hartmut Goebel | h.goebel@crazy-compilers.com | | www.crazy-compilers.com | compilers which you thought are impossible | --------------6A65D42712545950E5BBC99D Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hi,

I'm afraid, this patch will lead to quite some serious problems:

  • It "kills" the doc-string, which must be the very first expression-statement in the program. This might be rarely used, but
  • it kills "from __future__ import", which must be the first import statement (or even the first statement after any doc-string) to work.

Fixing these issues would require to implement a language-aware scanner, as discussed in <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00022.html>.

Thus I suggest aiming to implement the solution discussed in that thread (see esp. <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00041.html>.

Beside of this, the patch suffers from some more issues. Sorry to say :-(

  • When converting PYTHONPATH into a list of python strings, these need to be quoted properly.
  • The description (commit-message) of the patch is much to terse. It should describe the the reason and implications. Esp. it should describe the case this is fixing.

BTW: The first analysis in <https://bugs.gnu.org/29824> was misleading. I commented there.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |
--------------6A65D42712545950E5BBC99D-- From unknown Tue Jun 17 22:25:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#29856] [PATCH core-updates] guix: python-build-system:, Modify ".py" files in-place. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Jan 2018 17:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29856 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Hartmut Goebel Cc: Marius Bakke , 29856@debbugs.gnu.org Received: via spool by 29856-submit@debbugs.gnu.org id=B29856.151491399310120 (code B ref 29856); Tue, 02 Jan 2018 17:27:02 +0000 Received: (at 29856) by debbugs.gnu.org; 2 Jan 2018 17:26:33 +0000 Received: from localhost ([127.0.0.1]:33384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWQKf-0002d9-Ji for submit@debbugs.gnu.org; Tue, 02 Jan 2018 12:26:33 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:51656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWQKd-0002d1-HV for 29856@debbugs.gnu.org; Tue, 02 Jan 2018 12:26:32 -0500 Received: from localhost (178.113.223.176.wireless.dyn.drei.com [178.113.223.176]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 6F69733601D1; Tue, 2 Jan 2018 18:26:30 +0100 (CET) Date: Tue, 2 Jan 2018 18:26:27 +0100 From: Danny Milosavljevic Message-ID: <20180102182627.16566e3c@scratchpost.org> In-Reply-To: <86b45cc4-f8ef-95da-87f7-397db19c424e@crazy-compilers.com> References: <86b45cc4-f8ef-95da-87f7-397db19c424e@crazy-compilers.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hi Hartmut, thanks for the review! On Tue, 2 Jan 2018 17:13:15 +0100 Hartmut Goebel wrote: > * it kills "from __future__ import", which must be the first import > statement (or even the first statement after any doc-string) to work. ... oops. > Thus I suggest aiming to implement the solution discussed in that thread > (see esp. > . I like that approach. Nice... > Beside of this, the patch suffers from some more issues. Sorry to say :-( > > * When converting PYTHONPATH into a list of python strings, these need > to be quoted properly. I agree. > * The description (commit-message) of the patch is much to terse. It > should describe the the reason and implications. Esp. it should > describe the case this is fixing. Sure. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 04 02:56:28 2019 Received: (at control) by debbugs.gnu.org; 4 Feb 2019 07:56:29 +0000 Received: from localhost ([127.0.0.1]:58039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gqZ7E-0008V0-LO for submit@debbugs.gnu.org; Mon, 04 Feb 2019 02:56:28 -0500 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gqZ7C-0008Up-8G for control@debbugs.gnu.org; Mon, 04 Feb 2019 02:56:27 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1549266984; cv=none; d=zoho.com; s=zohoarc; b=n7jA1S/rL5MdIZu9iFMUsdtcbGKB1xOmlVgNmRufsuNowvdcfw4u/NW/oxRb9dytJmbeA59oYIybSCmsuV3CKxZG2yMPPDOomq1QecFpaCO5lxQeln5L6fJyhUzFQiB9BksyOjY2KBXNS0T8TWjNC4zPd4UvatKRIy8/zAl6yCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1549266984; h=Date:From:Message-ID:Subject:To:ARC-Authentication-Results; bh=l37L7dp6a2oStYZPqEoVz0L9cTW2fMj8eDgIsHBqCog=; b=irNPxKGE58fiIwD418ssBQdXPvfVEC8LBJMz5HQIheC2ZGSSOmdlr1bVYOBkdwalsmtyY/cR7ZVPJTQLuOdtJ+rmmSP4+xpurFsq7t06iV4mQ6PdpdvxpLL1MahD9cvSbfKoYmxYqk7d5R5qsZRgZtFHuvThyFgUBupngS0eAu8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1549266984; s=zoho; d=elephly.net; i=rekado@elephly.net; h=Date:To:From:Message-ID:Subject; l=20; bh=l37L7dp6a2oStYZPqEoVz0L9cTW2fMj8eDgIsHBqCog=; b=YyJ3H+T6vzhLoqo5vPtmeXPlaCM9VVGxlPOkYV4xwuCtDWzPBLuyWGgoX8e7TKJh VmENfqKJxNZ2Yrud5c72RT+CNjl0cY5+oqFIKXXNECUfcrLoKnwW/wbm1sUdBcc11H/ kmQwSbcjd4faNhESsEUHQbD5JDXxDT+9czmmWBD0= Received: from localhost (252.139-78-194.adsl-static.isp.belgacom.be [194.78.139.252]) by mx.zohomail.com with SMTPS id 1549266983026416.0678746181211; Sun, 3 Feb 2019 23:56:23 -0800 (PST) Date: Mon, 04 Feb 2019 08:56:20 +0100 To: control@debbugs.gnu.org From: Ricardo Wurmus Message-ID: <168b7821874.2bca155b400047763.-3085144038901161023@zoho.com> Subject: control message for bug #29856 X-ZohoMailClient: External X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 29856 wontfix From unknown Tue Jun 17 22:25:08 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Danny Milosavljevic Subject: bug#29856: closed (Re: [bug#29856] [PATCH core-updates] guix: python-build-system:, Modify ".py" files in-place.) Message-ID: References: <87pns8htnm.fsf@elephly.net> <20171226122105.19156-1-dannym@scratchpost.org> X-Gnu-PR-Message: they-closed 29856 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: wontfix patch Reply-To: 29856@debbugs.gnu.org Date: Mon, 04 Feb 2019 07:59:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1549267142-550-1" This is a multi-part message in MIME format... ------------=_1549267142-550-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #29856: [PATCH core-updates] guix: python-build-system: Modify ".py" files = in-place. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 29856@debbugs.gnu.org. --=20 29856: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D29856 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1549267142-550-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 29856-done) by debbugs.gnu.org; 4 Feb 2019 07:58:39 +0000 Received: from localhost ([127.0.0.1]:58044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gqZ9L-000082-4n for submit@debbugs.gnu.org; Mon, 04 Feb 2019 02:58:39 -0500 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gqZ9J-00007s-60 for 29856-done@debbugs.gnu.org; Mon, 04 Feb 2019 02:58:37 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1549267105; cv=none; d=zoho.com; s=zohoarc; b=QxoMXM+H3bytFtZ0WuU8kMFK5fSCKp9aimBI0vFCuS92HoAEUGC2qWo1/aj0hmW3yv/cjvE9kcJngVHDSguOWwK71KLAPO/o6PPKx5Y+VrWgReB0ARLx8GnmBCMa1RWUIHDg0TjYhGeoR40loWmcaDOP8SgmxSHTcez/iycVugA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1549267105; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=f3GPlHqsLdkF065mn4gyIdudsewFEorAFeP76KAtlyI=; b=HcUrRx1Ogm0TA38cajLQaQ4PpqO19YaRgaobwqOmq9LoHVxTsuuGIXQuYn3UjGQzKAcaYmkjNh1vOfe95jnIcocM6F17KUkCEtdh5QehfmmzP3PEYfvVzFOI24BRv5D7zwTAmprCstX6cTfI+Th5dBQ3TL932yFjZTX52vtTOIo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1549267105; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; l=979; bh=f3GPlHqsLdkF065mn4gyIdudsewFEorAFeP76KAtlyI=; b=MMAu7YMV9j9Qy+BK5xFeHgTyT/ctzRxWuqPJ9A+C00CtCe04hc9lSSd5f6G2CTTP 5Sbz43eDyMsS3rKtT6az3S7pLTF65sIy8SNbAG+r2QcUE1ZwZ8ExzHwxq7w3pfbpf4U 4J3JUpwWaYabNjlk/Nw6PinoIkYqWgXP+t7nn0Hw= Received: from localhost (252.139-78-194.adsl-static.isp.belgacom.be [194.78.139.252]) by mx.zohomail.com with SMTPS id 154926710429386.88489068186641; Sun, 3 Feb 2019 23:58:24 -0800 (PST) From: Ricardo Wurmus To: Danny Milosavljevic Subject: Re: [bug#29856] [PATCH core-updates] guix: python-build-system:, Modify ".py" files in-place. References: <86b45cc4-f8ef-95da-87f7-397db19c424e@crazy-compilers.com> <20180102182627.16566e3c@scratchpost.org> Date: Mon, 04 Feb 2019 08:58:21 +0100 In-Reply-To: <20180102182627.16566e3c@scratchpost.org> (Danny Milosavljevic's message of "Tue, 2 Jan 2018 18:26:27 +0100") Message-ID: <87pns8htnm.fsf@elephly.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 29856-done Cc: Hartmut Goebel , Marius Bakke , 29856-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Danny Milosavljevic writes: > > On Tue, 2 Jan 2018 17:13:15 +0100 > Hartmut Goebel wrote: > >> * it kills "from __future__ import", which must be the first import >> statement (or even the first statement after any doc-string) to work. > > ... oops. > >> Thus I suggest aiming to implement the solution discussed in that thread >> (see esp. >> . > > I like that approach. Nice... > >> Beside of this, the patch suffers from some more issues. Sorry to say :-( >>=20 >> * When converting PYTHONPATH into a list of python strings, these need >> to be quoted properly. > > I agree. > >> * The description (commit-message) of the patch is much to terse. It >> should describe the the reason and implications. Esp. it should >> describe the case this is fixing. > > Sure. I=E2=80=99m closing this in favour of #29951. Thanks! ------------=_1549267142-550-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 26 Dec 2017 12:21:22 +0000 Received: from localhost ([127.0.0.1]:52421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eToEU-0001VQ-15 for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eToET-0001VD-2x for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eToEN-0003xW-5R for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55890) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eToEN-0003xQ-2F for submit@debbugs.gnu.org; Tue, 26 Dec 2017 07:21:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eToEL-0007gF-Tf for guix-patches@gnu.org; Tue, 26 Dec 2017 07:21:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eToEI-0003ug-MP for guix-patches@gnu.org; Tue, 26 Dec 2017 07:21:13 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:40074) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eToEI-0003tg-GD for guix-patches@gnu.org; Tue, 26 Dec 2017 07:21:10 -0500 Received: from dayas.3.home (77.118.177.251.wireless.dyn.drei.com [77.118.177.251]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 3C95E33601CF; Tue, 26 Dec 2017 13:21:08 +0100 (CET) From: Danny Milosavljevic To: guix-patches@gnu.org Subject: [PATCH core-updates] guix: python-build-system: Modify ".py" files in-place. Date: Tue, 26 Dec 2017 13:21:05 +0100 Message-Id: <20171226122105.19156-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.15.1 Tags: patch X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) * guix/build/python-build-system.scm (wrap-python-program): New variable. (wrap-program*): New variable. (wrap): Use wrap-program*. --- guix/build/python-build-system.scm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index dd07986b9..f5f6b07f8 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -25,6 +25,7 @@ #:use-module (guix build utils) #:use-module (ice-9 match) #:use-module (ice-9 ftw) + #:use-module (ice-9 rdelim) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases @@ -184,6 +185,32 @@ when running checks after installing the package." configure-flags))) (call-setuppy "install" params use-setuptools?))) +(define (wrap-python-program file-name vars) + "Wrap the given program as a Python script (in-place)" + (match vars + (("PYTHONPATH" 'prefix python-path) + (let ((pythonish-path (string-join python-path "', '"))) + (with-atomic-file-replacement file-name + (lambda (in out) + (display (format #f "#!~a +import sys +sys.path = ['~a'] + sys.path +" (which "python") pythonish-path) out) + (let loop ((line (read-line in 'concat))) + (if (eof-object? line) + #t + (begin + (display line out) + (loop (read-line in 'concat))))))))))) + +(define (wrap-program* file-name vars) + "Wrap the given program. + If FILE-NAME is ending in '.py', wraps it in a Python way. + Otherwise wraps it in a Bash way." + (if (string-suffix? ".py" file-name) + (wrap-python-program file-name vars) + (wrap-program file-name vars))) + (define* (wrap #:key inputs outputs #:allow-other-keys) (define (list-of-files dir) (map (cut string-append dir "/" <>) @@ -209,7 +236,7 @@ when running checks after installing the package." (or (getenv "PYTHONPATH") "")))))) (for-each (lambda (dir) (let ((files (list-of-files dir))) - (for-each (cut wrap-program <> var) + (for-each (cut wrap-program* <> var) files))) bindirs))) ------------=_1549267142-550-1--