import: PyPI: Update redirected URL.
* guix/import/pypi.scm (guix-package->pypi-name, pypi->guix-package): Update docstrings. (pypi-package?): Test for pypi.org, too. (pypi-fetch): s/pypi.python.org/pypi.org/ * tests/pypi.scm ("guix-package->pypi-name, new URL style", "pypi->guix-package", "pypi->guix-package, wheels"): Likewise.
This commit is contained in:
parent
20de675a2e
commit
8440db459a
|
@ -51,8 +51,7 @@
|
||||||
(define (pypi-fetch name)
|
(define (pypi-fetch name)
|
||||||
"Return an alist representation of the PyPI metadata for the package NAME,
|
"Return an alist representation of the PyPI metadata for the package NAME,
|
||||||
or #f on failure."
|
or #f on failure."
|
||||||
(json-fetch-alist (string-append "https://pypi.python.org/pypi/"
|
(json-fetch-alist (string-append "https://pypi.org/pypi/" name "/json")))
|
||||||
name "/json")))
|
|
||||||
|
|
||||||
;; For packages found on PyPI that lack a source distribution.
|
;; For packages found on PyPI that lack a source distribution.
|
||||||
(define-condition-type &missing-source-error &error
|
(define-condition-type &missing-source-error &error
|
||||||
|
@ -87,7 +86,7 @@ package."
|
||||||
(string-append "python-" (snake-case name))))
|
(string-append "python-" (snake-case name))))
|
||||||
|
|
||||||
(define (guix-package->pypi-name package)
|
(define (guix-package->pypi-name package)
|
||||||
"Given a Python PACKAGE built from pypi.python.org, return the name of the
|
"Given a Python PACKAGE built from pypi.org, return the name of the
|
||||||
package on PyPI."
|
package on PyPI."
|
||||||
(define (url->pypi-name url)
|
(define (url->pypi-name url)
|
||||||
(hyphen-package-name->name+version
|
(hyphen-package-name->name+version
|
||||||
|
@ -269,7 +268,7 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
|
||||||
(license ,(license->symbol license)))))))
|
(license ,(license->symbol license)))))))
|
||||||
|
|
||||||
(define (pypi->guix-package package-name)
|
(define (pypi->guix-package package-name)
|
||||||
"Fetch the metadata for PACKAGE-NAME from pypi.python.org, and return the
|
"Fetch the metadata for PACKAGE-NAME from pypi.org, and return the
|
||||||
`package' s-expression corresponding to that package, or #f on failure."
|
`package' s-expression corresponding to that package, or #f on failure."
|
||||||
(let ((package (pypi-fetch package-name)))
|
(let ((package (pypi-fetch package-name)))
|
||||||
(and package
|
(and package
|
||||||
|
@ -304,7 +303,8 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
|
||||||
"Return true if PACKAGE is a Python package from PyPI."
|
"Return true if PACKAGE is a Python package from PyPI."
|
||||||
|
|
||||||
(define (pypi-url? url)
|
(define (pypi-url? url)
|
||||||
(or (string-prefix? "https://pypi.python.org/" url)
|
(or (string-prefix? "https://pypi.org/" url)
|
||||||
|
(string-prefix? "https://pypi.python.org/" url)
|
||||||
(string-prefix? "https://pypi.io/packages" url)))
|
(string-prefix? "https://pypi.io/packages" url)))
|
||||||
|
|
||||||
(let ((source-url (and=> (package-source package) origin-uri))
|
(let ((source-url (and=> (package-source package) origin-uri))
|
||||||
|
|
|
@ -89,7 +89,7 @@ baz > 13.37")
|
||||||
(dummy-package "foo"
|
(dummy-package "foo"
|
||||||
(source (dummy-origin
|
(source (dummy-origin
|
||||||
(uri
|
(uri
|
||||||
"https://pypi.python.org/packages/a2/3b/4756e6a0ceb14e084042a2a65c615d68d25621c6fd446d0fc10d14c4ce7d/certbot-0.8.1.tar.gz"))))))
|
"https://pypi.org/packages/a2/3b/4756e6a0ceb14e084042a2a65c615d68d25621c6fd446d0fc10d14c4ce7d/certbot-0.8.1.tar.gz"))))))
|
||||||
|
|
||||||
(test-equal "guix-package->pypi-name, several URLs"
|
(test-equal "guix-package->pypi-name, several URLs"
|
||||||
"cram"
|
"cram"
|
||||||
|
@ -120,7 +120,7 @@ baz > 13.37")
|
||||||
(mock ((guix http-client) http-fetch
|
(mock ((guix http-client) http-fetch
|
||||||
(lambda (url . rest)
|
(lambda (url . rest)
|
||||||
(match url
|
(match url
|
||||||
("https://pypi.python.org/pypi/foo/json"
|
("https://pypi.org/pypi/foo/json"
|
||||||
(values (open-input-string test-json)
|
(values (open-input-string test-json)
|
||||||
(string-length test-json)))
|
(string-length test-json)))
|
||||||
("https://example.com/foo-1.0.0-py2.py3-none-any.whl" #f)
|
("https://example.com/foo-1.0.0-py2.py3-none-any.whl" #f)
|
||||||
|
@ -182,7 +182,7 @@ baz > 13.37")
|
||||||
(mock ((guix http-client) http-fetch
|
(mock ((guix http-client) http-fetch
|
||||||
(lambda (url . rest)
|
(lambda (url . rest)
|
||||||
(match url
|
(match url
|
||||||
("https://pypi.python.org/pypi/foo/json"
|
("https://pypi.org/pypi/foo/json"
|
||||||
(values (open-input-string test-json)
|
(values (open-input-string test-json)
|
||||||
(string-length test-json)))
|
(string-length test-json)))
|
||||||
("https://example.com/foo-1.0.0-py2.py3-none-any.whl" #f)
|
("https://example.com/foo-1.0.0-py2.py3-none-any.whl" #f)
|
||||||
|
|
Loading…
Reference in New Issue