mirror of
https://codeberg.org/guix/guix.git
synced 2026-01-25 03:55:08 -06:00
import: pypi: Improve license detection.
A lot of python packages are generated with an #f license, despite the license being on pypi and in metadata. Fix this. * gnu/import/pypi.scm (find-license): Add procedure. (make-pypi-sexp): Use procedure find-license. Change-Id: Ia8e476f85a4b9193a0634de7a9bd66e40dcf2d44 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
parent
e1cc126ed7
commit
73fe38fd56
1 changed files with 13 additions and 3 deletions
|
|
@ -631,9 +631,8 @@ VERSION."
|
|||
(description ,(and=> (non-empty-string-or-false
|
||||
(project-info-summary info))
|
||||
beautify-description))
|
||||
(license ,(license->symbol
|
||||
(string->license
|
||||
(project-info-license info)))))
|
||||
(license ,(find-license (project-info-license info)
|
||||
(project-info-classifiers info))))
|
||||
(map upstream-input-name (upstream-source-inputs source)))))
|
||||
|
||||
(define pypi->guix-package
|
||||
|
|
@ -686,6 +685,17 @@ source. To build it from source, refer to the upstream repository at
|
|||
("MPL 2.0" license:mpl2.0)
|
||||
(_ #f)))
|
||||
|
||||
(define (find-license license classifiers)
|
||||
(license->symbol
|
||||
(string->license
|
||||
(if (and license (string? license) (not (string= license "")))
|
||||
license
|
||||
(let* ((license-prefix "License :: OSI Approved :: ")
|
||||
(license (find (cut string-prefix? license-prefix <>)
|
||||
classifiers)))
|
||||
(and license (not (null? license))
|
||||
(string-drop license (string-length license-prefix))))))))
|
||||
|
||||
(define pypi-package?
|
||||
(url-predicate
|
||||
(lambda (url)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue