diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-08-16 21:09:19 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-08-27 18:02:35 -0400 |
commit | 140b3048155d8fe4b8598786c014139ac5a91706 (patch) | |
tree | 9e07f54e4ab718976c1d65602b622accfe5e0a7f /guix/import/pypi.scm | |
parent | f8da3af08655acf2bb016e3a84bcba9b16e667ff (diff) |
import: pypi: Move generally useful procedures to utils module.
* guix/import/pypi.scm (make-pypi-sexp): Factorize license to symbol
conversion code.
(string->license, snake-case, guix-hash-url): Move from here...
* guix/import/utils.scm: ... to here.
(license->symbol): New procedure.
Diffstat (limited to 'guix/import/pypi.scm')
-rw-r--r-- | guix/import/pypi.scm | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index 10d5bad017..06d21fea45 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -31,8 +31,6 @@ #:use-module (guix utils) #:use-module (guix import utils) #:use-module (guix import json) - #:use-module (guix base32) - #:use-module (guix hash) #:use-module (guix packages) #:use-module (guix licenses) #:use-module (guix build-system python) @@ -49,16 +47,6 @@ DELIMETER." ((elem . rest) (cons* elem delimiter (join rest delimiter))))) -(define string->license - (match-lambda - ("GNU LGPL" lgpl2.0) - ("GPL" gpl3) - ((or "BSD" "BSD License") bsd-3) - ((or "MIT" "MIT license" "Expat license") expat) - ("Public domain" public-domain) - ("Apache License, Version 2.0" asl2.0) - (_ #f))) - (define (pypi-fetch name) "Return an alist representation of the PyPI metadata for the package NAME, or #f on failure." @@ -75,15 +63,6 @@ or #f on failure." (assoc-ref* pypi-package "info" "name") (assoc-ref* pypi-package "info" "version"))))) -(define (snake-case str) - "Return a downcased version of the string STR where underscores are replaced -with dashes." - (string-join (string-split (string-downcase str) #\_) "-")) - -(define (guix-hash-url filename) - "Return the hash of FILENAME in nix-base32 format." - (bytevector->nix-base32-string (file-sha256 filename))) - (define (python->package-name name) "Given the NAME of a package on PyPI, return a Guix-compliant name for the package." @@ -205,13 +184,7 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." (home-page ,home-page) (synopsis ,synopsis) (description ,description) - (license ,(assoc-ref `((,lgpl2.0 . lgpl2.0) - (,gpl3 . gpl3) - (,bsd-3 . bsd-3) - (,expat . expat) - (,public-domain . public-domain) - (,asl2.0 . asl2.0)) - license))))))) + (license ,(license->symbol license))))))) (define (pypi->guix-package package-name) "Fetch the metadata for PACKAGE-NAME from pypi.python.org, and return the |