On Thu, Oct 1, 2009 at 7:52 AM, Allan McRae <allan@archlinux.org> wrote:
Hi,
This is one part of the makepkg test suite I am working on. It is fairly a simple class that takes a pacman package filename and does some parsing. Currently that involves getting the file list and the info from the .PKGINFO file.
I am still fairly new to python so I am looking for comments on how this could be improved. One idea I have had is to not initialize all the fields in the pkginfo dict and add a test if an array exists before appending. It would make the code tidier but that would mean the need to test if the field exists when comparing it later.
Might be worth comparing this to reporead.py in archweb, which parses DBs as opposed to packages. One thing eliott did there that would make this a little less verbose, he has a tuple of valid keys, and uses that to construct the resulting dictionary. Also, if you're going to be dealing with lots of packages, he does some neat 'set' tricks