Пример #1
0
def _list_to_pkglist(packages):
    """
    Convert list of Packages to libcomps PackageList object.

    Args:
        list: a list of Packages

    Returns:
        pkglist: a libcomps PackageList

    """
    pkglist = libcomps.PackageList()

    for pkg_lst in packages:
        for pkg in pkg_lst[1]:
            lib_pkg = libcomps.Package()
            if isinstance(pkg, list):
                lib_pkg.name = pkg[0]
                lib_pkg.requires = pkg[1]
            else:
                lib_pkg.name = pkg
            lib_pkg.type = pkg_lst[0]
            pkglist.append(lib_pkg)

    return pkglist
Пример #2
0
    def list_to_pkglist(cls, lst):
        """
        Convert list of Packages to libcomps PackageList object.

        Args:
            list: a list of Packages

        Returns:
            pkglist: a libcomps PackageList

        """
        pkglist = libcomps.PackageList()
        for pkg in lst:
            lib_pkg = libcomps.Package()
            lib_pkg.name = pkg["name"]
            lib_pkg.type = pkg["type"]
            lib_pkg.basearchonly = bool(pkg["basearchonly"])
            lib_pkg.requires = pkg["requires"]
            pkglist.append(lib_pkg)

        return pkglist