1 from regexes import re_verwithext
2 from dak_exceptions import UnknownFormatError
6 Parse a .changes Format string into a tuple representation for easy
9 >>> parse_format('1.0')
11 >>> parse_format('8.4 (hardy)')
14 If the format doesn't match these forms, raises UnknownFormatError.
17 format = re_verwithext.search(txt)
20 raise UnknownFormatError, txt
22 format = format.groups()
25 format = int(float(format[0])), 0, format[2]
27 format = int(format[0]), int(format[1]), format[2]
34 def validate_changes_format(format, field):
36 Validate a tuple-representation of a .changes Format: field. Raises
37 UnknownFormatError if the field is invalid, otherwise return type is
41 if (format < (1, 5) or format > (1, 8)):
42 raise UnknownFormatError, repr(format)
44 if field != 'files' and format < (1, 8):
45 raise UnknownFormatError, repr(format)