From a10b9aebe42342bfc0dfc67897a0d5b65d83ce2d Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Tue, 23 Jun 2015 11:21:17 -0500 Subject: Make load_copyright stop processing a file if a critical piece (Format header, License) is missing --- load_copyright.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3