示例#1
0
    def _rawpkg_to_pkg(self, rawpkg):
        # type: (apt_pkg.Package) -> Package
        """Returns the apt.Package object for an apt_pkg.Package object.

        .. versionadded:: 1.0.0
        """
        fullname = rawpkg.get_fullname(pretty=True)

        return self._weakref.setdefault(fullname, Package(self, rawpkg))
示例#2
0
 def __iter__(self):
     # type: () -> Iterator[Package]
     # We iterate sorted over package names here. With this we read the
     # package lists linearly if we need to access the package records,
     # instead of having to do thousands of random seeks; the latter
     # is disastrous if we use compressed package indexes, and slower than
     # necessary for uncompressed indexes.
     for pkgname in self.keys():
         pkg = Package(self, self._cache[pkgname])
         yield self._weakref.setdefault(pkgname, pkg)
示例#3
0
文件: cache.py 项目: P79N6A/docker
    def _rawpkg_to_pkg(self, rawpkg):
        """Returns the apt.Package object for an apt_pkg.Package object.

        .. versionadded:: 1.0.0
        """
        fullname = rawpkg.get_fullname(pretty=False)
        try:
            pkg = self._weakref[fullname]
        except KeyError:
            pkg = Package(self, rawpkg)
            self._weakref[fullname] = pkg
        return pkg
示例#4
0
 def __init__(self):
     self.__depcache = None
     self.packages = {
         'kano-updater':
         Package('kano-updater', [
             Version('kano-updater', '3.14.1'),
             Version('kano-updater', LATEST_VERSION, 12, 13),
         ]),
         'test-pkg-1':
         Package('test-pkg-1', [
             Version('test-pkg-1', '1.0-0'),
             Version('test-pkg-1', '1.3-4', 23, 33),
         ]),
         'test-pkg-2':
         Package('test-pkg-2', [
             Version('test-pkg-2', '1.1-1'),
             Version('test-pkg-2', '2.3-4', 84, 0),
         ]),
         'test-pkg-3':
         Package('test-pkg-3', [
             Version('test-pkg-3', '3.0-0'),
             Version('test-pkg-3', '3.3-4', 0, 46),
         ]),
         'test-pkg-4':
         Package('test-pkg-4', [
             Version('test-pkg-4', '4.3-1'),
             Version('test-pkg-4', '4.3-4', 99, 265, prio=2000),
         ]),
         'test-pkg-5':
         Package('test-pkg-5', [
             Version('test-pkg-5', '5.3-4'),
         ]),
     }