[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: parsing/using *.dsc *.changes, *.deb etc., from Python



> See if http://ftp-master.debian.org/bzr/debian-archive-kit/ helps you.

This looks good, thanks!

> python-debian aims to be a bundle of Python libraries to deal with
> Debian-specific file formats. As such I would consider it to be the
> official tool (disclaimer: but I'm one of the maintainers, so my
> judgment is biased for sure!).
>
> Note that for some of its jobs, python-debian at times uses external
> libraries as, for example, python-apt.
>
> > I am just putting it here for future reference if someone tries to
> > unify these to spare him some time investigating the options.
>
> python-debian aims at unifying stuff, maybe it's just not so widespread
> (yet).

Awesome. Maybe you could help for example the maintainer of
git-hgbuildpackage to use python-debian, so that all the code is on
one place.

BTW, I tried your example
/usr/share/doc/python-debian/examples/packages/grep-maintainer and it
doesn't work:

$ ./grep-maintainer "stefano"
Traceback (most recent call last):
  File "./grep-maintainer", line 26, in ?
    if maint_RE.search(pkg['maintainer']):
TypeError: list indices must be integers


so please apply this patch to get it work:

diff -r bb09c7963ded grep-maintainer
--- a/grep-maintainer   Mon Oct 29 12:42:59 2007 +0100
+++ b/grep-maintainer   Mon Oct 29 12:48:08 2007 +0100
@@ -23,6 +23,7 @@ except:

 packages = PackageFile('/var/lib/dpkg/status')
 for pkg in packages:
-    if maint_RE.search(pkg['maintainer']):
+    pkg = dict(pkg)
+    if "maintainer" in pkg and maint_RE.search(pkg['maintainer']):
         print pkg['package']


Now it works:

$ ./grep-maintainer "stefano"
mc


Ondrej



Reply to: