From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: change to the wrap-program procedure (was: core-updates, =?utf-8?Q?let=E2=80=99s?= go!) Date: Tue, 02 Jan 2018 20:01:53 +0100 Message-ID: <877et05bku.fsf@elephly.net> References: <87shbr19ba.fsf@gnu.org> <20171231103219.GB5133@macbook41> <20171231121416.5df20c3b@scratchpost.org> <87a7xzaqc6.fsf@fastmail.com> <87mv1yajv3.fsf@elephly.net> <138af4ac-f1de-168f-c3a8-284769a32396@crazy-compilers.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWRpF-0001sf-Fj for guix-devel@gnu.org; Tue, 02 Jan 2018 14:02:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWRpC-00057e-C0 for guix-devel@gnu.org; Tue, 02 Jan 2018 14:02:13 -0500 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21048) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eWRpC-00057A-1s for guix-devel@gnu.org; Tue, 02 Jan 2018 14:02:10 -0500 In-reply-to: <138af4ac-f1de-168f-c3a8-284769a32396@crazy-compilers.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Hartmut Goebel Cc: Guix-devel Hi Hartmut, > Am 31.12.2017 um 18:27 schrieb Ricardo Wurmus: >> There=E2=80=99s also a change to the wrap-program procedure that does wi= thout >> the shell wrappers and instead prepends a short Guile program, which is >> read as a comment in the target language. It=E2=80=99s better to play w= ith this >> in the next core-updates cycle. > > I assume, this is what we discussed in > . > > I just wonder whether this will keep the encoding-lines in place, like > these: > > #!/usr/bin/python > # -*- coding: latin-1 -*- > from __future__ import print_function In the current implementation that I have here it would not. According to the documentation[1], the regular expression =E2=80=9Ccoding[=3D:]\s*([-\w.]+)=E2=80=9D must match for a comment on the = second line of a script, so I=E2=80=99d think that the following would still be valid: --8<---------------cut here---------------start------------->8--- #!/gnu/store/=E2=80=A6/bin/guile --no-auto-compile #!#; -*- coding: latin-1 -*- #\-(setenv =E2=80=A6) #\-(apply execl =E2=80=A6) #!/gnu/store/=E2=80=A6/bin/python3 # -*- coding: latin-1 -*- =E2=80=A6 --8<---------------cut here---------------end--------------->8--- All we need to do is read the second line of the script and see if it is a coding comment; in that case we=E2=80=99d place the content on the second line. I=E2=80=99ll add a special case for this and a test case. Thanks fo= r bringing it up! [1]: https://docs.python.org/3/reference/lexical_analysis.html#encoding-dec= larations -- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net