Source: python-debian
Severity: wishlist
User: check-all-the-thi...@packages.debian.org
Usertags: new-check
Control: affects -1 check-all-the-things

The debian.changelog & debian.copyright modules have a number of checks
for Debian changelog/copyright files. It would be nice to have access to these 
checks using a command-line tool like this prototype:

==> /usr/bin/check-python-debian <==
#!/usr/bin/python3
from debian import changelog, copyright
with open('debian/copyright') as f:
        copyright.Copyright(f)
with open('debian/changelog') as f:
        changelog.Changelog(f)

==> /usr/lib/python3/dist-packages/debian/changelog.py <==
        if file is None:
            self._parse_error('Empty changelog file.', strict)
            return

            if not file.strip():
                self._parse_error('Empty changelog file.', strict)
                return

                        if kv_match is None:
                            self._parse_error(
                                "Invalid key-value pair after ';': %s" % pair,

                        if key.lower() in all_keys:
                            self._parse_error(
                                "Repeated key-value: "

                            if val_match is None:
                                self._parse_error(
                                    "Badly formatted urgency value: %s" %

                        continue
                    self._parse_error(
                        "Unexpected line while looking for %s: %s" %

                    if end_match.group(3) != '  ':
                        self._parse_error(
                            "Badly formatted trailer line: %s" % line, strict)

                    if not allow_empty_author:
                        self._parse_error(
                            "Badly formatted trailer line: %s" % line, strict)

                        continue
                    self._parse_error(
                        "Unexpected line while looking for %s: %s" %

                    and old_state != next_heading_or_eof)):
            self._parse_error(
                "Found eof where expected %s" % state, strict)

==> /usr/lib/python3/dist-packages/debian/copyright.py <==

                else:
                    _complain('Non-header paragraph has neither "Files" nor '
                              '"License" fields', strict)

            if 'Copyright' not in data:
                _complain('Files paragraph missing Copyright field', strict)
            if 'License' not in data:
                _complain('Files paragraph missing License field', strict)

            if not self.files:
                _complain('Files paragraph has empty Files field', strict)

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to