Esempio n. 1
0
    def search(self, name):
        """Return list of packages providing file with name.

        The list may point to internal structures of FilenamesList and may be
        changed by calls to addPkg() and removePkg()."""
        (dirname, basename) = functions.pathsplit2(name)
        return self.path.get(dirname, {}).get(basename, [])
Esempio n. 2
0
def genBasenames2(oldfilenames):
    (basenames, dirnames) = ([], [])
    for filename in oldfilenames:
        (dirname, basename) = functions.pathsplit2(filename)
        basenames.append(basename)
        dirnames.append(dirname)
    return (basenames, dirnames)
Esempio n. 3
0
    def search(self, name):
        """Return list of packages providing file with name.

        The list may point to internal structures of FilenamesList and may be
        changed by calls to addPkg() and removePkg()."""
        (dirname, basename) = functions.pathsplit2(name)
        return self.path.get(dirname, {}).get(basename, [])
Esempio n. 4
0
def genBasenames2(oldfilenames):
    (basenames, dirnames) = ([], [])
    for filename in oldfilenames:
        (dirname, basename) = functions.pathsplit2(filename)
        basenames.append(basename)
        dirnames.append(dirname)
    return (basenames, dirnames)
Esempio n. 5
0
    def numFileDuplicates(self, filename):
        (dirname, basename) = functions.pathsplit2(filename)
        if not self.basenames_cache.has_key(basename):
            data = self.basenames_db.get(basename, '')
            filedict = {}
            self.basenames_cache[basename] = filedict

            for id, idx in self.iterIdIdx(data):
                pkg = self.getPkgById(id)
                if not pkg:
                    continue
                f = pkg.iterFilenames()[idx]
                filedict.setdefault(f, []).append(pkg)
        return len(self.basenames_cache[basename].get(filename, []))
Esempio n. 6
0
    def searchFilenames(self, filename):
        (dirname, basename) = functions.pathsplit2(filename)
        data1 = self.basenames_db.get(basename, "")
        data2 = self.dirnames_db.get(dirname, '')
        dirname_ids = {}
        for id in self.iterId(data2):
            dirname_ids[id] = None

        result = []
        for id, idx in self.iterIdIdx(data1):
            if id not in dirname_ids:
                continue
            pkg = self.getPkgById(id)
            if pkg and pkg.iterFilenames()[idx] == filename:
                result.append(pkg)
        return result
Esempio n. 7
0
 def numDuplicates(self, filename):
     (dirname, basename) = functions.pathsplit2(filename)
     return len(self.path.get(dirname, {}).get(basename, {}))
Esempio n. 8
0
 def numDuplicates(self, filename):
     (dirname, basename) = functions.pathsplit2(filename)
     return len(self.path.get(dirname, {}).get(basename, {}))