Пример #1
0
 def loadPackageInfo(self, d):
     xml = getfile(path.join(self.__path, d, const.PACKAGE_INFO_FILE))
     if xml:
         package = pkg(xml)
         if package.right:
             self.__packages[package.n] = package
             return True
     return False
Пример #2
0
 def addRepo(self, name, url, xml):
     try:
         doc = etree.fromstring(xml)
         packageCount = len(doc.findall("Package"))
         for package in doc.getchildren():
             if package.tag == "Package":
                 p = pkg(package, name, url)
                 self.pkgDb[p.n] = p
     except:
         print "Error"
Пример #3
0
 def load(self, p):
     #
     self.__clear()
     self.__path = path.normpath(p)
     pkgdirs = listdir(self.__path)
     if not pkgdirs:
         return False
     totalPackages = len(pkgdirs)
     for d in pkgdirs:
         xml = getfile(path.join(self.__path, d, const.PACKAGE_INFO_FILE))
         if not xml:
             self.__clear()
             return False
         package = pkg(xml)
         if package.right:
             self.__packages[package.n] = package
             self.onProcessing.raiseEvent(self.__actCode, ratioCalc(totalPackages, len(self.__packages)), package.n)
         else:
             self.__clear()
             return False
     return True