@@ -0,0 +1,2084 @@
+#!/usr/bin/env python%0A%0Afrom copy import deepcopy%0Aimport pprint%0A%0Aclass AurInfo(object):%0A    def __init__(self):%0A        self._pkgbase = %7B%7D%0A        self._packages = %7B%7D%0A%0A    def GetPackageNames(self):%0A        return self._packages.keys()%0A%0A    def GetMergedPackage(self, pkgname):%0A        package = deepcopy(self._pkgbase)%0A        for k, v in self._packages.get(pkgname).items():%0A            package%5Bk%5D = deepcopy(v)%0A        return package%0A%0A    def AddPackage(self, pkgname):%0A        self._packages%5Bpkgname%5D = %7B%7D%0A        return self._packages%5Bpkgname%5D%0A%0A    def SetPkgbase(self, pkgbasename):%0A        self._pkgbase = %7B'pkgname' : pkgbasename%7D%0A        return self._pkgbase%0A%0A%0Adef GetPackage(aurinfo, pkgname):%0A    package = deepcopy(aurinfo%5B'pkgbase'%5D)%0A    for k, v in aurinfo%5Bpkgname%5D.items():%0A        package%5Bk%5D = deepcopy(v)%0A    return package%0A%0A%0Adef ListPackageNames(aurinfo):%0A    return (key for key in aurinfo.keys() if key != 'pkgbase')%0A%0Adef ParseAurinfo(filename='.AURINFO'):%0A    aurinfo = AurInfo()%0A%0A    with open(filename) as f:%0A        current_package = None%0A%0A        for line in f:%0A            line = line.rstrip()%0A%0A            if not line:%0A                # end of package%0A                current_package = None%0A            elif not line.startswith('%5Ct'):%0A                # start of new package%0A                key, value = line.split(' = ', 1)%0A                if key == 'pkgbase':%0A                    current_package = aurinfo.SetPkgbase(value)%0A                else:%0A                    current_package = aurinfo.AddPackage(value)%0A            else:%0A                # package attribute%0A                key, value = line.lstrip('%5Ct').split(' = ', 1)%0A                if not current_package.get(key):%0A                    current_package%5Bkey%5D = %5B%5D%0A                current_package%5Bkey%5D.append(value)%0A%0A    return aurinfo%0A%0A%0Aif __name__ == '__main__':%0A    pp = pprint.PrettyPrinter(indent=4)%0A    aurinfo = ParseAurinfo()%0A    for pkgname in aurinfo.GetPackageNames():%0A        print(%22%3E%3E%3E merged package: %25s%22 %25 pkgname)%0A        pp.pprint(aurinfo.GetMergedPackage(pkgname))%0A        print()%0A%0A

add python based .AURINFO parser