changeset 39124:9b79e837bfd8

module: custom hook for licenses field
author Dmitry Selyutin <ghostmansd@gmail.com>
date Tue, 03 Jul 2018 22:57:17 +0300
parents f9ec3654d894
children 74d963da30fa
files pygnulib/module.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pygnulib/module.py	Tue Jul 03 21:37:25 2018 +0300
+++ b/pygnulib/module.py	Tue Jul 03 22:57:17 2018 +0300
@@ -8,6 +8,7 @@
 import codecs as _codecs
 import collections as _collections
 import hashlib as _hashlib
+import itertools as _itertools
 import json as _json
 import os as _os
 import re as _re
@@ -485,6 +486,9 @@
         lambda line: line.strip() and not line.strip().startswith("#"),
         {line.strip() for line in text.split((",", "\n")["\n" in text.strip()])},
     ))
+    __LICENSES = lambda text: set(_itertools.chain.from_iterable(
+        line.split(" or ") for line in FileModule.__MULTILINE(text)
+    ))
     __TABLE = {
         "Description": (
             "description",
@@ -536,7 +540,7 @@
         ),
         "License": (
             "licenses",
-            __MULTILINE,
+            __LICENSES,
         ),
         "Maintainer": (
             "maintainers",