[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20220704

Jon TURNEY jturney@sourceware.org
Mon Jul 4 18:47:49 GMT 2022




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=a8331e01fec619db68298b3760851c6180dea5cb

commit a8331e01fec619db68298b3760851c6180dea5cb
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Mon Jul 4 19:47:35 2022 +0100

    Update version to 20220704

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=91763a3f68af2db7c2b90f61926a75c33b1b8306

commit 91763a3f68af2db7c2b90f61926a75c33b1b8306
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Mon Jul 4 19:00:52 2022 +0100

    Make license_expression an optional dependency


Diff:
---
 calm/hint.py | 28 ++++++++++++++++------------
 setup.py     |  2 +-
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/calm/hint.py b/calm/hint.py
index 99408d7..d464bbc 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -27,19 +27,23 @@
 
 from collections import OrderedDict
 import argparse
-import license_expression
 import re
 
-# reach inside license_expression to add custom license ids we permit
-json = license_expression.get_license_index()
-extra_licenses = [
-    'Linux-man-pages-copyleft',  # requires SPDX license-list 3.15
-    'Public-Domain',
-    'XVIEW',
-]
-for l in extra_licenses:
-    json.append({"spdx_license_key": l})
-licensing = license_expression.build_spdx_licensing(json)
+try:
+    import license_expression
+except ModuleNotFoundError:
+    licensing = None
+else:
+    # reach inside license_expression to add custom license ids we permit
+    json = license_expression.get_license_index()
+    extra_licenses = [
+        'Linux-man-pages-copyleft',  # requires SPDX license-list 3.15
+        'Public-Domain',
+        'XVIEW',
+    ]
+    for l in extra_licenses:
+        json.append({"spdx_license_key": l})
+    licensing = license_expression.build_spdx_licensing(json)
 
 # types of key:
 # 'multilineval' - always have a value, which may be multiline
@@ -291,7 +295,7 @@ def hint_file_parse(fn, kind, strict=False):
                             errors.append('message value must have id and text')
 
                     # license must be a valid spdx license expression
-                    if key == 'license':
+                    if key == 'license' and licensing:
                         try:
                             le = licensing.validate(value, strict=True)
                         except (license_expression.ExpressionParseError, license_expression.ExpressionError) as e:
diff --git a/setup.py b/setup.py
index 4afab46..338a9a7 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
 
 setup(
     name='calm',
-    version='20220627',
+    version='20220704',
     description='Cygwin packaging maintenance tool',
     long_description=open('README.md').read(),
     author='Jon Turney',



More information about the Cygwin-apps-cvs mailing list