all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell'.
@ 2023-01-27 11:12 Simon Tournier
  2023-02-03 22:54 ` Liliana Marie Prikler
  2023-03-16 11:21 ` bug#61094: " Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Tournier @ 2023-01-27 11:12 UTC (permalink / raw)
  To: 61094; +Cc: Simon Tournier

* doc/guix.texi (Invoking guix shell): Add a note mentioning how to use
'shebang'.
---
 doc/guix.texi | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 2b1ad77ba5..acda01c8e6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@*
 Copyright @copyright{} 2019 Alex Griffin@*
 Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le Vaillant@*
 Copyright @copyright{} 2020 Liliana Marie Prikler@*
-Copyright @copyright{} 2019, 2020, 2021, 2022 Simon Tournier@*
+Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@*
 Copyright @copyright{} 2020 Wiktor Żelazny@*
 Copyright @copyright{} 2020 Damien Cassou@*
 Copyright @copyright{} 2020 Jakub Kądziołka@*
@@ -5923,6 +5923,19 @@ building or downloading any missing package, and runs the
 guix shell python python-numpy -- python3
 @end example
 
+@quotation Note
+@cindex shebang
+@command{guix shell} can be used as @emph{shebang}.  Consider the
+previous example as an executable Python script, the @emph{shebang}
+reads,
+
+@example
+#!/usr/bin/env -S guix shell python python-nympy -- python3
+@end example
+
+All the @var{options} or convenience of @command{guix shell} apply.
+@end quotation
+
 Development environments can be created as in the example below, which
 spawns an interactive shell containing all the dependencies and
 environment variables needed to work on Inkscape:

base-commit: 8e1cca32b938cef0812ce042c6c2e8bccb326ec7
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell'.
  2023-01-27 11:12 [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell' Simon Tournier
@ 2023-02-03 22:54 ` Liliana Marie Prikler
  2023-02-07 11:48   ` zimoun
  2023-03-16 11:21 ` bug#61094: " Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Liliana Marie Prikler @ 2023-02-03 22:54 UTC (permalink / raw)
  To: Simon Tournier, 61094

Am Freitag, dem 27.01.2023 um 12:12 +0100 schrieb Simon Tournier:
> * doc/guix.texi (Invoking guix shell): Add a note mentioning how to
> use
> 'shebang'.
> ---
>  doc/guix.texi | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 2b1ad77ba5..acda01c8e6 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@*
>  Copyright @copyright{} 2019 Alex Griffin@*
>  Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le
> Vaillant@*
>  Copyright @copyright{} 2020 Liliana Marie Prikler@*
> -Copyright @copyright{} 2019, 2020, 2021, 2022 Simon Tournier@*
> +Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@*
>  Copyright @copyright{} 2020 Wiktor Żelazny@*
>  Copyright @copyright{} 2020 Damien Cassou@*
>  Copyright @copyright{} 2020 Jakub Kądziołka@*
> @@ -5923,6 +5923,19 @@ building or downloading any missing package,
> and runs the
>  guix shell python python-numpy -- python3
>  @end example
>  
> +@quotation Note
> +@cindex shebang
> +@command{guix shell} can be used as @emph{shebang}.  Consider the
> +previous example as an executable Python script, the @emph{shebang}
> +reads,
> +
> +@example
> +#!/usr/bin/env -S guix shell python python-nympy -- python3
> +@end example
> +
> +All the @var{options} or convenience of @command{guix shell} apply.
> +@end quotation
> +
Is this really guix running as a shell or is it actually a feature of
env?  In either case, it's worth documenting, but we should try to stay
factually correct.

Cheers




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell'.
  2023-02-03 22:54 ` Liliana Marie Prikler
@ 2023-02-07 11:48   ` zimoun
  2023-02-09 16:07     ` Morgan Smith
  0 siblings, 1 reply; 6+ messages in thread
From: zimoun @ 2023-02-07 11:48 UTC (permalink / raw)
  To: Liliana Marie Prikler, 61094

Hi,

On Fri, 03 Feb 2023 at 23:54, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

>> +@quotation Note
>> +@cindex shebang
>> +@command{guix shell} can be used as @emph{shebang}.  Consider the
>> +previous example as an executable Python script, the @emph{shebang}
>> +reads,
>> +
>> +@example
>> +#!/usr/bin/env -S guix shell python python-nympy -- python3
>> +@end example
>> +
>> +All the @var{options} or convenience of @command{guix shell} apply.
>> +@end quotation
>> +
>
> Is this really guix running as a shell or is it actually a feature of
> env?  In either case, it's worth documenting, but we should try to stay
> factually correct.

Well, I am not sure to understand the question.  It is a feature of env
which allows to run “guix shell” which provides python3 as “shell”.

From my understanding, all written seems factually correct.  Maybe I am
missing something and I would be happy to be corrected if I am doing
wrong. :-)

Cheers,
simon




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell'.
  2023-02-07 11:48   ` zimoun
@ 2023-02-09 16:07     ` Morgan Smith
  2023-03-16 11:09       ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Morgan Smith @ 2023-02-09 16:07 UTC (permalink / raw)
  To: zimoun; +Cc: Liliana Marie Prikler, 61094

Hello,

>>> +@example
>>> +#!/usr/bin/env -S guix shell python python-nympy -- python3
>>> +@end example

Apparently, according to POSIX you're only allowed one argument on the
'#!' line after the path of the executable.  I haven't confirmed this
myself but it is in the guile manual, section 4.3.2 "The Meta Switch".

One argument does seem quite limiting though so I wonder if anyone
actually imposes that limit.


Morgan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell'.
  2023-02-09 16:07     ` Morgan Smith
@ 2023-03-16 11:09       ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2023-03-16 11:09 UTC (permalink / raw)
  To: Morgan Smith; +Cc: 61094, Liliana Marie Prikler, zimoun

Hi,

Morgan Smith <Morgan.J.Smith@outlook.com> skribis:

>>>> +@example
>>>> +#!/usr/bin/env -S guix shell python python-nympy -- python3
>>>> +@end example
>
> Apparently, according to POSIX you're only allowed one argument on the
> '#!' line after the path of the executable.  I haven't confirmed this
> myself but it is in the guile manual, section 4.3.2 "The Meta Switch".
>
> One argument does seem quite limiting though so I wonder if anyone
> actually imposes that limit.

Yes, and ‘env -S’ is used to work around that limitation by splitting
that one argument.  It’s a GNU extension, which is fine in this context.

Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#61094: [PATCH] doc: Document 'shebang' for 'guix shell'.
  2023-01-27 11:12 [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell' Simon Tournier
  2023-02-03 22:54 ` Liliana Marie Prikler
@ 2023-03-16 11:21 ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2023-03-16 11:21 UTC (permalink / raw)
  To: Simon Tournier; +Cc: 61094-done

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

> * doc/guix.texi (Invoking guix shell): Add a note mentioning how to use
> 'shebang'.

Applied with the changes below.  

Thanks!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1100 bytes --]

diff --git a/doc/guix.texi b/doc/guix.texi
index 9c1fc04265..aa98d7df4b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5940,16 +5940,19 @@ guix shell python python-numpy -- python3
 @end example
 
 @quotation Note
-@cindex shebang
-@command{guix shell} can be used as @emph{shebang}.  Consider the
-previous example as an executable Python script, the @emph{shebang}
-reads,
+@cindex shebang, for @command{guix shell}
+@command{guix shell} can be also be used as a script interpreter, also
+known as @dfn{shebang}.  Here is an example self-contained Python script
+making use of this feature:
 
 @example
-#!/usr/bin/env -S guix shell python python-nympy -- python3
+#!/usr/bin/env -S guix shell python python-numpy -- python3
+import numpy
+print("This is numpy", numpy.version.version)
 @end example
 
-All the @var{options} or convenience of @command{guix shell} apply.
+You may pass any @command{guix shell} option, but there's one caveat:
+the Linux kernel has a limit of 127 bytes on shebang length.
 @end quotation
 
 Development environments can be created as in the example below, which

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-16 11:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 11:12 [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell' Simon Tournier
2023-02-03 22:54 ` Liliana Marie Prikler
2023-02-07 11:48   ` zimoun
2023-02-09 16:07     ` Morgan Smith
2023-03-16 11:09       ` Ludovic Courtès
2023-03-16 11:21 ` bug#61094: " Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.