def collect_pspecs(visitor, dirname=None): if not dirname: dirname = config.pspec_folder # populate the list global allSpecs if allSpecs: for x in allSpecs: apply(visitor,x) return allSpecs = [] for root, dirs, files in os.walk(dirname): if "pspec.xml" in files: try: sf = pisi.specfile.SpecFile() sf.read(os.path.join(root, "pspec.xml")) allSpecs.append( (sf, root) ) visitor(sf, root) # found a package, dont go deeper for d in dirs: dirs.remove(d) except Exception, inst: print "Broken package", root print inst # dont walk into the versioned stuff if ".svn" in dirs: dirs.remove(".svn")