Package: python-debian
Version: 0.1.8
Severity: normal
Tags: patch

the PackageFile example currently crashes with a TypeError:

[EMAIL PROTECTED]:~$ python 
/usr/share/doc/python-debian/examples/packages/grep-maintainer terceiro
Traceback (most recent call last):
  File "/usr/share/doc/python-debian/examples/packages/grep-maintainer", line 
26, in ?
    if maint_RE.search(pkg['maintainer']):
TypeError: list indices must be integers

This happens because the __yield__ method in PackageFile class has two yield
statements, one 'yield pkg' and other 'yield dict(pkg)'.

The attached patch fixes the problem by putting dict() around 'pkg' in the
first yield.


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-1-686 (SMP w/1 CPU core)
Locale: LANG=pt_BR.utf8, LC_CTYPE=pt_BR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-debian depends on:
ii  python                        2.4.4-6    An interactive high-level object-o
ii  python-support                0.7.5      automated rebuilding support for p

python-debian recommends no packages.

-- no debconf information

-- 
Antonio Terceiro <[EMAIL PROTECTED]>
http://people.softwarelivre.org/~terceiro/
GnuPG ID: 0F9CB28F


=== modified file 'debian_bundle/debian_support.py'
--- debian_bundle/debian_support.py	2007-07-12 10:22:05 +0000
+++ debian_bundle/debian_support.py	2007-12-26 14:16:41 +0000
@@ -183,7 +183,7 @@
             if line == '\n':
                 if len(pkg) == 0:
                     self.raiseSyntaxError('expected package record')
-                yield pkg
+                yield dict(pkg)
                 pkg = []
                 line = self.file.readline()
                 self.lineno += 1

Reply via email to