daklib.formats

Helper functions for the various changes formats

@contact: Debian FTPMaster <ftpmaster@debian.org> @copyright: 2009, 2010 Joerg Jaspert <joerg@debian.org> @copyright: 2009 Chris Lamb <lamby@debian.org> @license: GNU General Public License version 2 or later

Functions

parse_format(txt)

Parse a .changes Format string into a tuple representation for easy comparison.

validate_changes_format(format, field)

Validate a tuple-representation of a .changes Format: field.

daklib.formats.parse_format(txt: str) tuple[source]

Parse a .changes Format string into a tuple representation for easy comparison.

>>> parse_format('1.0')
(1, 0)
>>> parse_format('8.4 (hardy)')
(8, 4, 'hardy')

If the format doesn’t match these forms, raises UnknownFormatError.

Parameters:

txt – Format string to parse

Returns:

Parsed format

Raises:

UnknownFormatError – Unknown Format: line

daklib.formats.validate_changes_format(format: tuple[int], field: str) None[source]

Validate a tuple-representation of a .changes Format: field. Raises UnknownFormatError if the field is invalid, otherwise return type is undefined.

Raises:

UnknownFormatError – if the field is invalid