diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index 4f9518f2eb..9c72e73314 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2014 David Thompson ;;; Copyright © 2015 Cyril Roelandt ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -322,15 +323,17 @@ (define (pypi-url? url) (define (latest-release package) "Return an for the latest release of PACKAGE." - (guard (c ((missing-source-error? c) #f)) - (let* ((pypi-name (guix-package->pypi-name package)) - (metadata (pypi-fetch pypi-name)) - (version (assoc-ref* metadata "info" "version")) - (url (assoc-ref (latest-source-release metadata) "url"))) - (upstream-source - (package (package-name package)) - (version version) - (urls (list url)))))) + (let* ((pypi-name (guix-package->pypi-name package)) + (pypi-package (pypi-fetch pypi-name))) + (and pypi-package + (guard (c ((missing-source-error? c) #f)) + (let* ((metadata pypi-package) + (version (assoc-ref* metadata "info" "version")) + (url (assoc-ref (latest-source-release metadata) "url"))) + (upstream-source + (package (package-name package)) + (version version) + (urls (list url)))))))) (define %pypi-updater (upstream-updater