import: pypi: Gracefully handle non-existent packages.

Fixes <http://bugs.gnu.org/18831>.
Reported by Ian Denhardt <ian@zenhack.net>.

* guix/import/pypi.scm (url-fetch, json-fetch, pypi-fetch): Augment
  docstring to mention #f on failure.
  (pypi->guix-package): Likewise, and actually return #f on failure.
* guix/scripts/import/pypi.scm (guix-import-pypi): Call 'leave' when
  'pypi->guix-package' returns #f.
This commit is contained in:
Ludovic Courtès 2014-11-05 17:56:39 +01:00
parent 63854bcbb1
commit 467a3c93db
2 changed files with 20 additions and 14 deletions

View file

@ -80,4 +80,8 @@ Import and convert the PyPI package for PACKAGE-NAME.\n"))
(reverse opts))))
(match args
((package-name)
(pypi->guix-package package-name)))))
(let ((sexp (pypi->guix-package package-name)))
(unless sexp
(leave (_ "failed to download meta-data for package '~a'~%")
package-name))
sexp)))))