Subject: bug#54258: recursive pypi importer prints backtrace when package does not exist

From: Ricardo Wurmus <[email-masked]>
Date: Sat, 05 Mar 2022 11:46:00 +0100

The recursive pypi importer prints a backtrace when a package does not exist:

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix import pypi -r doesnotexist
following redirection to `https://pypi.org/pypi/doesnotexist/json/'...
Backtrace:
In ice-9/boot-9.scm:
  1752:10 11 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
          10 (apply-smob/0 #<thunk 7fe2ed3202e0>)
In ice-9/boot-9.scm:
    724:2  9 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8  8 (_ #(#(#<directory (guile-user) 7fe2ed325c80>)))
In guix/ui.scm:
   2229:7  7 (run-guix . _)
  2192:10  6 (run-guix-command _ . _)
In guix/scripts/import.scm:
   124:11  5 (guix-import . _)
In ice-9/boot-9.scm:
  1752:10  4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/scripts/import/pypi.scm:
    97:21  3 (_)
In guix/import/utils.scm:
   507:27  2 (recursive-import "doesnotexist" #:repo->guix-package _ #:guix-name _ #:version _ #:repo _)
   497:33  1 (lookup-node "doesnotexist" #f)
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong number of values returned to continuation (expected 2)
--8<---------------cut here---------------end--------------->8---

The non-recursive importer does a better job here:

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix import pypi doesnotexist
following redirection to `https://pypi.org/pypi/doesnotexist/json/'...
guix import: error: failed to download meta-data for package 'doesnotexist'
--8<---------------cut here---------------end--------------->8---

-- 
Ricardo