diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-11-12 18:38:41 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-11-12 18:41:20 +0100 |
commit | 3b5a7ddbe6f230bcb659104765a2da0837a3f283 (patch) | |
tree | cdd368fab90ab545c75a7aa4cdcb92291dcb60d5 /gbp/deb | |
parent | 758908b3b08cd94d412b3d146d7be9bb1256dc25 (diff) |
changelog: handle comma in maintainers name
Thanks: Andreas Beckmann for the proposed fix
Closes: #737623
Diffstat (limited to 'gbp/deb')
-rw-r--r-- | gbp/deb/changelog.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py index bcda3f4c..1d499821 100644 --- a/gbp/deb/changelog.py +++ b/gbp/deb/changelog.py @@ -190,14 +190,15 @@ class ChangeLog(object): """ The author of the last modification """ - return email.utils.parseaddr(self._cp['Maintainer'])[0] + + return self._parse_maint(self._cp['Maintainer'])[0] @property def email(self): """ The author's email """ - return email.utils.parseaddr(self._cp['Maintainer'])[1] + return self._parse_maint(self._cp['Maintainer'])[1] @property def date(self): @@ -326,3 +327,19 @@ class ChangeLog(object): def get_changes(self, since='0~'): return self._run_parsechangelog(['-v%s' % since, '-SChanges']) + + @staticmethod + def _parse_maint(maintainer): + """ + Parse maintainer + + Mostly rfc822 but we allow for commas + """ + def _quote(u): + return u.replace(',', '##comma##') + + def _unquote(q): + return q.replace('##comma##', ',') + + name, mail = email.utils.parseaddr(_quote(maintainer or '')) + return (_unquote(name), _unquote(mail)) |