aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@trisquel.info>2015-06-23 11:21:17 -0500
committerRuben Rodriguez <ruben@trisquel.info>2015-06-26 10:06:50 -0500
commita10b9aebe42342bfc0dfc67897a0d5b65d83ce2d (patch)
treebad1d714033f9bd4ab08247a1022e200ea2d9982
parent44127cdd8e80bded5f4c80072145c6ed30e8fee6 (diff)
Make load_copyright stop processing a file if a critical piece (Format header, License) is missing
-rw-r--r--load_copyright.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/load_copyright.py b/load_copyright.py
index 580da8c..a5b1f5d 100644
--- a/load_copyright.py
+++ b/load_copyright.py
@@ -24,9 +24,11 @@ def read_copyright(fh):
paras = [(p.keys()[0], dict(p)) for p in paras]
except (KeyError, TypeError, StopIteration):
raise BadFormat('not in DEP-5 format?')
+ return
- if 'Format' not in header and 'Format-Specification' not in header:
+ if 'Format' not in header:
raise ValueError('no Format field')
+ return
files = []
licences = []
@@ -46,6 +48,7 @@ def read_copyright(fh):
if type == 'Files':
if 'License' not in d:
raise ValueError('no license: ' + repr(d))
+ return
#keys = set(d.keys())
#assert keys <= file_fields, keys