guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: import: pypi: Emit 'pypi-uri' only when it yields the right URL.


From: Ludovic Courtès
Subject: 01/02: import: pypi: Emit 'pypi-uri' only when it yields the right URL.
Date: Sun, 20 Mar 2016 00:08:27 +0000

civodul pushed a commit to branch master
in repository guix.

commit 522773b70024272555aab0448fae8606add4c582
Author: Ludovic Courtès <address@hidden>
Date:   Sat Mar 19 23:49:59 2016 +0100

    import: pypi: Emit 'pypi-uri' only when it yields the right URL.
    
    Fixes <http://bugs.gnu.org/23062>.
    Reported by Danny Milosavljevic <address@hidden>.
    
    * guix/import/pypi.scm (make-pypi-sexp): Check whether 'pypi-uri'
    returns SOURCE-URL and fall back to the full URL otherwise.
    * tests/pypi.scm ("pypi->guix-package"): Adjust expected URI
    accordingly.
    
    Co-authored-by: Danny Milosavljevic <address@hidden>
---
 guix/import/pypi.scm |   12 ++++++++++--
 tests/pypi.scm       |    3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index d54bb9f..8ae4948 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 David Thompson <address@hidden>
 ;;; Copyright © 2015 Cyril Roelandt <address@hidden>
-;;; Copyright © 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015, 2016 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -194,7 +194,15 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and 
LICENSE."
              (version ,version)
              (source (origin
                        (method url-fetch)
-                       (uri (pypi-uri ,name version))
+
+                       ;; Sometimes 'pypi-uri' doesn't quite work due to mixed
+                       ;; cases in NAME, for instance, as is the case with
+                       ;; "uwsgi".  In that case, fall back to a full URL.
+                       (uri ,(if (equal? (pypi-uri name version) source-url)
+                                 `(pypi-uri ,name version)
+                                 `(string-append
+                                   ,@(factorize-uri source-url version))))
+
                        (sha256
                         (base32
                          ,(guix-hash-url temp)))))
diff --git a/tests/pypi.scm b/tests/pypi.scm
index 960b8cd..cf351a5 100644
--- a/tests/pypi.scm
+++ b/tests/pypi.scm
@@ -84,7 +84,8 @@ baz > 13.37")
          ('version "1.0.0")
          ('source ('origin
                     ('method 'url-fetch)
-                    ('uri (pypi-uri "foo" version))
+                    ('uri (string-append "https://example.com/foo-";
+                                         version ".tar.gz"))
                     ('sha256
                      ('base32
                       (? string? hash)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]