Hi Hartmut, > Am 31.12.2017 um 18:27 schrieb Ricardo Wurmus: >> There’s also a change to the wrap-program procedure that does without >> the shell wrappers and instead prepends a short Guile program, which is >> read as a comment in the target language. It’s better to play with this >> in the next core-updates cycle. > > I assume, this is what we discussed in > <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00041.html>. > > 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 “coding[=:]\s*([-\w.]+)” must match for a comment on the second line of a script, so I’d think that the following would still be valid: --8<---------------cut here---------------start------------->8--- #!/gnu/store/…/bin/guile --no-auto-compile #!#; -*- coding: latin-1 -*- #\-(setenv …) #\-(apply execl …) #!/gnu/store/…/bin/python3 # -*- coding: latin-1 -*- … --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’d place the content on the second line. I’ll add a special case for this and a test case. Thanks for bringing it up! [1]: https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations -- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net