diff options
-rw-r--r-- | gbp/deb/changelog.py | 22 | ||||
-rw-r--r-- | tests/test_Changelog.py | 22 |
2 files changed, 44 insertions, 0 deletions
diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py index 674e9e7a..b8c10b86 100644 --- a/gbp/deb/changelog.py +++ b/gbp/deb/changelog.py @@ -126,3 +126,25 @@ class ChangeLog(object): Whether this is a native Debian package """ return not '-' in self.version + + @property + def author(self): + """ + The author of the last modification + """ + return email.Utils.parseaddr(self._cp['Maintainer'])[0] + + @property + def email(self): + """ + The author's email + """ + return email.Utils.parseaddr(self._cp['Maintainer'])[1] + + @property + def date(self): + """ + The date of the last modification as rfc822 date + """ + return self._cp['Date'] + diff --git a/tests/test_Changelog.py b/tests/test_Changelog.py index be22b8a2..9048e205 100644 --- a/tests/test_Changelog.py +++ b/tests/test_Changelog.py @@ -170,3 +170,25 @@ def test_parse_name(): >>> cl.name 'git-buildpackage' """ + +def test_parse_last_mod(): + """ + Test author, email and date of last modification + + Methods tested: + - L{gbp.deb.changelog.ChangeLog.__init__} + + Properties tested: + - L{gbp.deb.changelog.ChangeLog.name} + - L{gbp.deb.changelog.ChangeLog.email} + - L{gbp.deb.changelog.ChangeLog.date} + + >>> import gbp.deb.changelog + >>> cl = gbp.deb.changelog.ChangeLog(cl_debian) + >>> cl.author.startswith('Guido') + True + >>> cl.email + 'agx@sigxcpu.org' + >>> cl.date + 'Mon, 17 Oct 2011 10:15:22 +0200' + """ |