From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Craven Subject: [PATCH 03/12] import: Move string->license to importers. Date: Thu, 22 Sep 2016 15:18:54 +0200 Message-ID: <20160922131903.1606-3-david@craven.ch> References: <20160922131903.1606-1-david@craven.ch> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3ui-0004Se-LV for guix-devel@gnu.org; Thu, 22 Sep 2016 09:20:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn3uT-0001ag-G8 for guix-devel@gnu.org; Thu, 22 Sep 2016 09:19:43 -0400 Received: from so254-10.mailgun.net ([198.61.254.10]:35291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3uS-0001X8-3l for guix-devel@gnu.org; Thu, 22 Sep 2016 09:19:29 -0400 In-Reply-To: <20160922131903.1606-1-david@craven.ch> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * 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 b3a50ac..df6b498 100644 --- a/guix/import/gem.scm +++ b/guix/import/gem.scm @@ -28,7 +28,7 @@ #:use-module (guix import utils) #: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 @@ -154,6 +154,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 3f24014..60067db 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -40,7 +40,7 @@ #:use-module ((guix download) #:prefix download:) #: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 @@ -293,6 +293,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 8535841..b5dcc17 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -38,7 +38,6 @@ json-fetch guix-hash-url - string->license license->symbol snake-case @@ -113,15 +112,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) -- 2.9.0