Subject: [bug#29847] [PATCH] import: pypi: Stay in the REPL if fail to get a source

From: [email-masked] (Ludovic Courtès)
Date: Thu, 11 Jan 2018 22:39:59 +0100

Hi Oleg,

Oleg Pykhalov <[email-masked]> skribis:

> If pypi->guix-package fails to get a source release, could we return
> false instead of killing a running Guile REPL session?

Note that at the REPL you can always do:

  (catch 'quit (lambda () …) (const #f))

>           (guard (c ((missing-source-error? c)
>                      (let ((package (missing-source-error-package c)))
> -                      (leave (G_ "no source release for pypi package ~a ~a~%")
> -                             (assoc-ref* package "info" "name")
> -                             (assoc-ref* package "info" "version")))))
> +                      (format (current-error-port)
> +                              (G_ "no source release for pypi package ~a ~a~%")
> +                              (assoc-ref* package "info" "name")
> +                              (assoc-ref* package "info" "version"))
> +                      #f)))

OK for the patch, but please simply replace ‘leave’ with ‘warning’.

Note that for me the motivation is not to avoid exiting REPLs since it’s
easy to avoid anyway.  The motivation is rather to make it easier to
integrate importers in applications other than ‘guix import’: ‘guix
refresh’ is one of them, but then I’d also like importers/updaters to be
directly used from ‘guix package’.  For that, it’s a good idea to avoid
calling ‘exit’ on the first occasion, obviously.

Thanks,
Ludo’.