Your message dated Sat, 9 Jul 2011 23:12:08 -0700
with message-id <[email protected]>
and subject line Re: Bug#593525: python-debian: Please add a Control object
has caused the Debian Bug report #593525,
regarding python-debian: Please add a Control object
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
593525: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593525
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python-debian
Version: 0.1.16
Severity: wishlist

I want to parse a debian/control file and found no 'Control' object that
represents a debian/control file. I had to create my own Crontol object that
contains a list of Deb822 objects:

def get_blocks(blocks, line):
        if line.strip() == "":
                blocks.append(list())
        else:
                blocks[-1].append(line)
        return blocks

lines = open("debian/control").readlines()
blocks = reduce(get_blocks, lines, [[]])
self.blocks = map(debian.deb822.Deb822, blocks)

Please add a Control object.



--- End Message ---
--- Begin Message ---
On Sat, Sep 25, 2010 at 06:50:45PM +0200, Benjamin Drung wrote:
> Am Mittwoch, den 25.08.2010, 16:40 -0700 schrieb John Wright:
> > The classes in the deb822 packages each represent one "paragraph" of a
> > multi-paragraph file.  What you probably want is the iter_paragraphs
> > method on Deb822 (and hence all of its subclasses).  It yields one
> > object for each paragraph in the file.  Control files have no special
> > multivalued fields, so the Deb822 class should work fine:
> > 
> >     for paragraph in deb822.Deb822.iter_paragraphs(open('debian/control')):
> >         # paragraph is a Deb822 object.
> >     print paragraph.items()
> > 
> > We could probably use some better documentation for new users....
> 
> Thanks. That simplifies my code. You can inspect wrap-and-sort in
> ubuntu-dev-tools >= 0.102 (from experimental).

Looks like iter_paragraphs did the trick.  Feel free to reopen or file a
new bug if we need some special handling for control paragraphs.

Thanks,
-- 
John Wright <[email protected]>

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to