import: pypi: Preserve package name case when forming pypi-uri.

Fixes <https://bugs.gnu.org/33046>.

* guix/build-system/python.scm (pypi-uri): Update the host URI to
"files.pythonhosted.org".
* guix/import/pypi.scm (make-pypi-sexp): Preserve the package name case when
the source URL calls for it.
This commit is contained in:
Maxim Cournoyer 2019-03-30 20:27:35 -04:00
parent a537620054
commit 4b60ab8c00
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 14 additions and 9 deletions

View File

@ -368,12 +368,17 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
`(package `(package
(name ,(python->package-name name)) (name ,(python->package-name name))
(version ,version) (version ,version)
(source (origin (source
(origin
(method url-fetch) (method url-fetch)
;; Sometimes 'pypi-uri' doesn't quite work due to mixed ;; PyPI URL are case sensitive, but sometimes a project
;; cases in NAME, for instance, as is the case with ;; named using mixed case has a URL using lower case, so
;; "uwsgi". In that case, fall back to a full URL. ;; we must work around this inconsistency. For actual
(uri (pypi-uri ,(string-downcase name) version)) ;; examples, compare the URLs of the "Deprecated" and
;; "uWSGI" PyPI packages.
(uri ,(if (string-contains source-url name)
`(pypi-uri ,name version)
`(pypi-uri ,(string-downcase name) version)))
(sha256 (sha256
(base32 (base32
,(guix-hash-url temp))))) ,(guix-hash-url temp)))))