From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6Df9-0001aU-KE for guix-patches@gnu.org; Thu, 04 May 2017 06:07:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6Df5-0007f8-DY for guix-patches@gnu.org; Thu, 04 May 2017 06:07:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:55379) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d6Df5-0007f3-9Z for guix-patches@gnu.org; Thu, 04 May 2017 06:07:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d6Df5-00081y-3S for guix-patches@gnu.org; Thu, 04 May 2017 06:07:03 -0400 Subject: bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release. Resent-Message-ID: From: Mathieu Othacehe Date: Thu, 4 May 2017 12:06:27 +0200 Message-Id: <20170504100627.27553-3-m.othacehe@gmail.com> In-Reply-To: <20170504100627.27553-1-m.othacehe@gmail.com> References: <20170504100627.27553-1-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26772@debbugs.gnu.org * guix/import/pypi.scm (latest-release): Check if pypi-fetch has failed. If so return #f, else construct the . --- guix/import/pypi.scm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index 4f9518f2e..9c72e7331 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 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." (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 -- 2.12.2