X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fformats.py;fp=daklib%2Fformats.py;h=aaad2715aac119bd40766d1cef333f9cf2df36df;hb=e102ad02c396868d6f6c514f42a641e78f7fca9b;hp=e8ab1d77d205f85db14ee80ea2cd5173e7ce8b3f;hpb=ef55b8c79ae2d3e593aacb7a1f4a3c893bf62094;p=dak.git diff --git a/daklib/formats.py b/daklib/formats.py index e8ab1d77..aaad2715 100644 --- a/daklib/formats.py +++ b/daklib/formats.py @@ -30,3 +30,16 @@ def parse_format(txt): format = format[:2] return format + +def validate_changes_format(format, field): + """ + Validate a tuple-representation of a .changes Format: field. Raises + UnknownFormatError if the field is invalid, otherwise return type is + undefined. + """ + + if (format < (1, 5) or format > (1, 8)): + raise UnknownFormatError, repr(format) + + if field != 'files' and format < (1, 8): + raise UnknownFormatError, repr(format)