mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
import: Move string->license to importers.
* guix/import/gem.scm (string->license): Move from (guix import utils). * guix/import/pypi.scm (string->license): Move from (guix import utils).
This commit is contained in:
parent
fbe9c10128
commit
263ac57fc2
3 changed files with 24 additions and 11 deletions
|
@ -29,7 +29,7 @@ (define-module (guix import gem)
|
|||
#:use-module (guix import json)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix upstream)
|
||||
#:use-module (guix licenses)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix base32)
|
||||
#:use-module (guix build-system ruby)
|
||||
#:export (gem->guix-package
|
||||
|
@ -155,6 +155,17 @@ (define (guix-package->gem-name package)
|
|||
;; e.g. "https://rubygems.org/downloads/hashery-2.1.1.gem"
|
||||
(substring source-url 31 (string-rindex source-url #\-))))
|
||||
|
||||
(define (string->license str)
|
||||
"Convert the string STR into a license object."
|
||||
(match str
|
||||
("GNU LGPL" license:lgpl2.0)
|
||||
("GPL" license:gpl3)
|
||||
((or "BSD" "BSD License") license:bsd-3)
|
||||
((or "MIT" "MIT license" "Expat license") license:expat)
|
||||
("Public domain" license:public-domain)
|
||||
((or "Apache License, Version 2.0" "Apache 2.0") license:asl2.0)
|
||||
(_ #f)))
|
||||
|
||||
(define (gem-package? package)
|
||||
"Return true if PACKAGE is a gem package from RubyGems."
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ (define-module (guix import pypi)
|
|||
#:use-module (guix import json)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix upstream)
|
||||
#:use-module (guix licenses)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix build-system python)
|
||||
#:use-module (gnu packages python)
|
||||
#:export (guix-package->pypi-name
|
||||
|
@ -294,6 +294,17 @@ (define (pypi->guix-package package-name)
|
|||
(make-pypi-sexp name version release wheel home-page synopsis
|
||||
description license))))))
|
||||
|
||||
(define (string->license str)
|
||||
"Convert the string STR into a license object."
|
||||
(match str
|
||||
("GNU LGPL" license:lgpl2.0)
|
||||
("GPL" license:gpl3)
|
||||
((or "BSD" "BSD License") license:bsd-3)
|
||||
((or "MIT" "MIT license" "Expat license") license:expat)
|
||||
("Public domain" license:public-domain)
|
||||
((or "Apache License, Version 2.0" "Apache 2.0") license:asl2.0)
|
||||
(_ #f)))
|
||||
|
||||
(define (pypi-package? package)
|
||||
"Return true if PACKAGE is a Python package from PyPI."
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ (define-module (guix import utils)
|
|||
url-fetch
|
||||
guix-hash-url
|
||||
|
||||
string->license
|
||||
license->symbol
|
||||
|
||||
snake-case
|
||||
|
@ -110,15 +109,7 @@ (define (guix-hash-url filename)
|
|||
"Return the hash of FILENAME in nix-base32 format."
|
||||
(bytevector->nix-base32-string (file-sha256 filename)))
|
||||
|
||||
(define (string->license str)
|
||||
"Convert the string STR into a license object."
|
||||
(match str
|
||||
("GNU LGPL" license:lgpl2.0)
|
||||
("GPL" license:gpl3)
|
||||
((or "BSD" "BSD License") license:bsd-3)
|
||||
((or "MIT" "MIT license" "Expat license") license:expat)
|
||||
("Public domain" license:public-domain)
|
||||
((or "Apache License, Version 2.0" "Apache 2.0") license:asl2.0)
|
||||
(_ #f)))
|
||||
|
||||
(define (license->symbol license)
|
||||
|
|
Loading…
Reference in a new issue