Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2022-08-15 12:59:41 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2022-08-15 13:00:33 +0300
commit7157342b6c04ce3dfeace4ba92053e6e4793b21a (patch)
tree4068bf67ee83d1464acf1cf5a367a8e729eeef6f
parent8325fded1ccb121c57ad689470a76542a8609500 (diff)
Report non-exception errors from license.expression.validate()
Also make that error reporting a bit more consistent Also allow hint checker to be run on src.hint files
-rwxr-xr-xcalm/hint.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/calm/hint.py b/calm/hint.py
index 363cfb4..9ae25aa 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -299,10 +299,14 @@ def hint_file_parse(fn, kind, strict=False):
try:
licensing.parse(value, strict=True)
le = licensing.validate(value, strict=True)
- except (license_expression.ExpressionParseError, license_expression.ExpressionError) as e:
- errors.append('value for key %s not a valid license expression: %s' % (key, e))
+ except license_expression.ExpressionParseError as e:
+ errors.append('errors parsing license expression: %s' % (e))
+ except license_expression.ExpressionError as e:
+ errors.append('errors validating license expression: %s' % (e))
else:
- if le.original_expression != le.normalized_expression:
+ if not le.normalized_expression:
+ errors.append('errors in license expression: %s' % (le.errors))
+ elif le.original_expression != le.normalized_expression:
errors.append("license expression: '%s' normalizes to '%s'" % (value, le.normalized_expression))
# warn if value starts with a quote followed by whitespace
@@ -415,7 +419,7 @@ def main(args):
status = 0
for fn in args.files:
- hints = hint_file_parse(fn, pvr)
+ hints = hint_file_parse(fn, spvr if fn.endswith('src.hint') else pvr)
if args.verbose > 1:
print(hints)