guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/04: import: Move string->license to importers.


From: David Craven
Subject: 02/04: import: Move string->license to importers.
Date: Wed, 28 Sep 2016 11:49:26 +0000 (UTC)

dvc pushed a commit to branch master
in repository guix.

commit 263ac57fc22680395453bed34eaae8e63ea85bbb
Author: David Craven <address@hidden>
Date:   Thu Sep 22 11:30:17 2016 +0200

    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).
---
 guix/import/gem.scm   |   13 ++++++++++++-
 guix/import/pypi.scm  |   13 ++++++++++++-
 guix/import/utils.scm |    9 ---------
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index fc06b0d..3d0c190 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -29,7 +29,7 @@
   #: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 @@ package on RubyGems."
     ;; 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."
 
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 343445a..8aeffb2 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -41,7 +41,7 @@
   #: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 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and 
LICENSE."
              (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."
 
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 4ec3b67..69e623a 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -35,7 +35,6 @@
             url-fetch
             guix-hash-url
 
-            string->license
             license->symbol
 
             snake-case
@@ -110,15 +109,7 @@ recursively apply the procedure to the sub-list."
   "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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]