Sebastian Nowicki wrote:
On Oct 1, 2009, at 2:52 PM, Allan McRae 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.
I didn't really look at the script, but I made a similar parser [1] earlier, initially for AUR2 purposes. Looking over it, it seems I don't include the file list during parsing, but that can probably be easily added in. Perhaps it can be expanded upon, instead of creating a new one. If not it should at least help.
Ah.... I had seen that before but I thought it only parsed PKGBUILDs for some reason. I have been using that for some ideas for my PKGBUILD parser but it needed a big overhaul for package splitting. You script has reminded of some things (I should use a tuple instead of a list for the "arrays" variable) and I like the idea of mapping names to their PKGBUILD equivalents. Allan