diff options
Diffstat (limited to 'gbp/deb/changelog.py')
-rw-r--r-- | gbp/deb/changelog.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py index fa4ba10e..42fcb571 100644 --- a/gbp/deb/changelog.py +++ b/gbp/deb/changelog.py @@ -23,10 +23,12 @@ import os import subprocess from gbp.command_wrappers import Command + class NoChangeLogError(Exception): """No changelog found""" pass + class ParseChangeLogError(Exception): """Problem parsing changelog""" pass @@ -47,7 +49,7 @@ class ChangeLogSection(object): return self._version @classmethod - def parse(klass, section): + def parse(cls, section): """ Parse one changelog section @@ -59,7 +61,7 @@ class ChangeLogSection(object): header = section.split('\n')[0] package = header.split()[0] version = header.split()[1][1:-1] - return klass(package, version) + return cls(package, version) class ChangeLog(object): @@ -92,9 +94,9 @@ class ChangeLog(object): def _parse(self): """Parse a changelog based on the already read contents.""" cmd = subprocess.Popen(['dpkg-parsechangelog', '-l-'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) (output, errors) = cmd.communicate(self._contents) if cmd.returncode: raise ParseChangeLogError("Failed to parse changelog. " @@ -138,8 +140,8 @@ class ChangeLog(object): @property def version(self): - """The full version string""" - return self._cp['Version'] + """The full version string""" + return self._cp['Version'] @property def upstream_version(self): @@ -198,7 +200,7 @@ class ChangeLog(object): """ section = '' for line in self._contents.split('\n'): - if line and line[0] not in [ ' ', '\t' ]: + if line and line[0] not in [' ', '\t']: section += line else: if section: |