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

From: ng0 <[email-masked]>
Date: Mon, 25 Dec 2017 13:59:46 +0000

Oleg Pykhalov transcribed 2.9K bytes:
> Hello Guix,
> 
> If pypi->guix-package fails to get a source release, could we return
> false instead of killing a running Guile REPL session?
> 

Why? Could you give some reasons why the current behavior is bad
and what your code tries to improve in this regard?

> From 6bb461018fc4cd47d30ab27b5748b9e4cbce6e97 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <[email-masked]>
> Date: Mon, 25 Dec 2017 16:32:14 +0300
> Subject: [PATCH] import: pypi: Stay in the REPL if fail to get a source
>  release.
> 
> * guix/import/pypi.scm (pypi->guix-package): Return #f if no source release.
> ---
>  guix/import/pypi.scm | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
> index bb0db1ba8..3f37ea65f 100644
> --- a/guix/import/pypi.scm
> +++ b/guix/import/pypi.scm
> @@ -275,9 +275,11 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
>      (and package
>           (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)))
>             (let ((name (assoc-ref* package "info" "name"))
>                   (version (assoc-ref* package "info" "version"))
>                   (release (assoc-ref (latest-source-release package) "url"))
> -- 
> 2.15.1
> 

> Thanks,
> Oleg.

-- 
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://c.n0.is/ng0_pubkeys/tree/keys
  WWW: https://n0.is