31 Aug 2011 11:02
Re: python-debian Changelog module?
Hi Mark,
(Adding the project mailing list.)
On Tue, Aug 30, 2011 at 01:19:33PM +0000, Mark Kusch wrote:
> Hi,
>
> I wonder how python-debian Changelog module should be used to read and parse data from changelog files.
>
> It simply does not work, reproducable:
> - create changelog file with "simple_changelog" from examples folder
> $ /usr/share/doc/python-debian/examples/changelog/simple_changelog > /tmp/python-debian-test.changelog
> - gather information from generated changelog file
> >>> from debian.changelog import Changelog, Version
> >>> chlog = Changelog('/tmp/python-debian-test.changelog')
> >>> chlog.get_version()
The Changelog constructor takes the changelog contents as an iterable of
str or unicode lines (e.g. a file object), or a single str or unicode.
It doesn't take a filename. You want something like
>>> from debian import changelog
>>> f = open('/tmp/python-debian-test.changelog')
>>> c = changelog.Changelog(f)
>>> c.get_version()
Version('0.1')
It seems pretty clear in the docs:
>>> help(changelog.Changelog)
(Continue reading)
RSS Feed