Subject: bug#23780: [PATCH] import: pypi: do not fail when 'run_requires' is missing from the metadata.

From: Cyril Roelandt <[email-masked]>
Date: Fri, 17 Jun 2016 14:43:55 +0200

* guix/import/pypi.scm (read-wheel-metadata): do not crash when 'run_requires'
is missing from the metadata.
---
 guix/import/pypi.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 70ef507..f08d948 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -175,8 +175,10 @@ cannot determine package dependencies"))
                  (lambda (port)
                    (let* ((metadata (json->scm port))
                           (run_requires (hash-ref metadata "run_requires"))
-                          (requirements (hash-ref (list-ref run_requires 0)
-                                                  "requires")))
+                          (requirements (if run_requires
+                                          (hash-ref (list-ref run_requires 0)
+                                                     "requires")
+                                          '())))
                      (map (lambda (r)
                             (python->package-name (clean-requirement r)))
                           requirements)))))
-- 
2.6.2