mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-25 20:19:18 -05:00
import: pypi: Support exporting packages with .zip source.
* guix/import/pypi.scm (make-pypi-sexp): Rename test-inputs to native-inputs. Restructure the way pypi-uri parameters are generated. Use pypi-uri's extension parameter when required. Add "unzip" to native inputs when the package source is a zip file. Signed-off-by: Marius Bakke <mbakke@fastmail.com>
This commit is contained in:
parent
0c101a04f0
commit
9d0dfd9a9a
1 changed files with 24 additions and 10 deletions
|
@ -5,6 +5,7 @@
|
||||||
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
||||||
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
|
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -363,7 +364,11 @@ (define (make-pypi-sexp name version source-url wheel-url home-page synopsis
|
||||||
(receive (guix-dependencies upstream-dependencies)
|
(receive (guix-dependencies upstream-dependencies)
|
||||||
(compute-inputs source-url wheel-url temp)
|
(compute-inputs source-url wheel-url temp)
|
||||||
(match guix-dependencies
|
(match guix-dependencies
|
||||||
((required-inputs test-inputs)
|
((required-inputs native-inputs)
|
||||||
|
(when (string-suffix? ".zip" source-url)
|
||||||
|
(set! native-inputs (cons
|
||||||
|
'("unzip" ,unzip)
|
||||||
|
native-inputs)))
|
||||||
(values
|
(values
|
||||||
`(package
|
`(package
|
||||||
(name ,(python->package-name name))
|
(name ,(python->package-name name))
|
||||||
|
@ -371,20 +376,29 @@ (define (make-pypi-sexp name version source-url wheel-url home-page synopsis
|
||||||
(source
|
(source
|
||||||
(origin
|
(origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
;; PyPI URL are case sensitive, but sometimes a project
|
(uri (pypi-uri
|
||||||
;; named using mixed case has a URL using lower case, so
|
;; PyPI URL are case sensitive, but sometimes
|
||||||
;; we must work around this inconsistency. For actual
|
;; a project named using mixed case has a URL
|
||||||
;; examples, compare the URLs of the "Deprecated" and
|
;; using lower case, so we must work around this
|
||||||
;; "uWSGI" PyPI packages.
|
;; inconsistency. For actual examples, compare
|
||||||
(uri ,(if (string-contains source-url name)
|
;; the URLs of the "Deprecated" and "uWSGI" PyPI
|
||||||
`(pypi-uri ,name version)
|
;; packages.
|
||||||
`(pypi-uri ,(string-downcase name) version)))
|
,(if (string-contains source-url name)
|
||||||
|
name
|
||||||
|
(string-downcase name))
|
||||||
|
version
|
||||||
|
;; Some packages have been released as `.zip`
|
||||||
|
;; instead of the more common `.tar.gz`. For
|
||||||
|
;; example, see "path-and-address".
|
||||||
|
,@(if (string-suffix? ".zip" source-url)
|
||||||
|
'(".zip")
|
||||||
|
'())))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
,(guix-hash-url temp)))))
|
,(guix-hash-url temp)))))
|
||||||
(build-system python-build-system)
|
(build-system python-build-system)
|
||||||
,@(maybe-inputs required-inputs 'propagated-inputs)
|
,@(maybe-inputs required-inputs 'propagated-inputs)
|
||||||
,@(maybe-inputs test-inputs 'native-inputs)
|
,@(maybe-inputs native-inputs 'native-inputs)
|
||||||
(home-page ,home-page)
|
(home-page ,home-page)
|
||||||
(synopsis ,synopsis)
|
(synopsis ,synopsis)
|
||||||
(description ,description)
|
(description ,description)
|
||||||
|
|
Loading…
Reference in a new issue