import: pypi: Emit 'pypi-uri' only when it yields the right URL.
Fixes <http://bugs.gnu.org/23062>. Reported by Danny Milosavljevic <dannym@scratchpost.org>. * 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 <dannym@scratchpost.org>
This commit is contained in:
parent
329a702634
commit
522773b700
|
@ -1,7 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014 David Thompson <davet@gnu.org>
|
;;; Copyright © 2014 David Thompson <davet@gnu.org>
|
||||||
;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
|
;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
|
||||||
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -194,7 +194,15 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
|
||||||
(version ,version)
|
(version ,version)
|
||||||
(source (origin
|
(source (origin
|
||||||
(method url-fetch)
|
(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
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
,(guix-hash-url temp)))))
|
,(guix-hash-url temp)))))
|
||||||
|
|
|
@ -84,7 +84,8 @@ baz > 13.37")
|
||||||
('version "1.0.0")
|
('version "1.0.0")
|
||||||
('source ('origin
|
('source ('origin
|
||||||
('method 'url-fetch)
|
('method 'url-fetch)
|
||||||
('uri (pypi-uri "foo" version))
|
('uri (string-append "https://example.com/foo-"
|
||||||
|
version ".tar.gz"))
|
||||||
('sha256
|
('sha256
|
||||||
('base32
|
('base32
|
||||||
(? string? hash)))))
|
(? string? hash)))))
|
||||||
|
|
Loading…
Reference in New Issue