aboutsummaryrefslogtreecommitdiff
path: root/guix/import
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2017-05-04 11:57:50 +0200
committerMathieu Othacehe <m.othacehe@gmail.com>2017-05-13 12:40:20 +0200
commit22fc581db3a4985d1f8c6fd6b9763392c638c35b (patch)
treed0afa83bcd4b20bb733434683ded4194d376c96c /guix/import
parentdb427602d8f993ee0025fa68d1af274aa8d69ab9 (diff)
downloadgnu-guix-22fc581db3a4985d1f8c6fd6b9763392c638c35b.tar
gnu-guix-22fc581db3a4985d1f8c6fd6b9763392c638c35b.tar.gz
import: pypi: Robustify latest-release.
* guix/import/pypi.scm (latest-release): Check if pypi-fetch has failed. If so return #f, else construct the <upstream-source>.
Diffstat (limited to 'guix/import')
-rw-r--r--guix/import/pypi.scm21
1 files changed, 12 insertions, 9 deletions
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 <davet@gnu.org>
;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -322,15 +323,17 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
(define (latest-release package)
"Return an <upstream-source> 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