Bug#473793: python-debian: add support for parsing removals.txt
Stuart Prescott
stuart at debian.org
Tue Jun 14 15:23:05 UTC 2016
Hi Jakub,
On Tue, 14 Jun 2016 16:34:19 Jakub Wilk wrote:
> * Stuart Prescott <stuart at debian.org>, 2016-06-15, 00:02:
> >+ @property
> >+ def date(self):
> >+ """ a datetime object for the removal action """
> >+ try:
> >+ from dateutil.parser import parse
> >+ except ImportError:
> >+ warnings.warn("Install the python-dateutil or python3-dateutil
> >" + "package to process dates in package removals.") +
> > raise
> >+ return parse(self['date'])
>
> There's a RFC 822 date parser in Python stdlib
> (email.utils.parsedate_tz), so if we jumped through a hops or two, we
> could avoid this extra dependency.
good thought -- that might indeed be better.
(and importing repeatedly inside a function isn't very pretty at all)
> Hmm, I wonder how other parts of python-debian parse dates...
I can't spot any other places, actually.
The changelog parser doesn't even try, leaving them as strings instead; I'm
wary about trying to do too much in this code and wondering if I should not
parse the date at all and leave it as a string for the consumer to parse if
that is actually wanted.
> >+ self.assertEqual(r.bug, ['753912'])
> >+ self.assertEqual(r.also_wnpp, ['123456'])
>
> Shouldn't bug numbers be integers?
I wondered about that too, and then wondered about (a) trying to do too much
and (b) zero-padding in a few years.
The changelog parser does convert to integers, so perhaps this should too for
consistency.
thanks for the feedback!
cheers
Stuart
--
Stuart Prescott http://www.nanonanonano.net/ stuart at nanonanonano.net
Debian Developer http://www.debian.org/ stuart at debian.org
GPG fingerprint 90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7
More information about the pkg-python-debian-maint
mailing list