def test_find_grp_pkgs_error(): with pytest.raises(TypeError) as excinfo: pyalpm.find_grp_pkgs() assert 'expected arguments' in str(excinfo.value) with pytest.raises(TypeError) as excinfo: pyalpm.find_grp_pkgs([None], 'test') assert 'list must contain only Database objects' in str(excinfo.value)
def get_group_list(group): global groups_dict if group in groups_dict.keys(): return groups_dict[group] else: groups_dict[group] = Gtk.ListStore(object) dbs_list = [transaction.localdb] dbs_list.extend(transaction.syncdbs.copy()) pkgs = pyalpm.find_grp_pkgs(dbs_list, group) for pkg in pkgs: groups_dict[group].append([pkg]) return groups_dict[group]
def add_package(self, pkgname): #print("searching %s" % pkgname) try: for repo in self.handle.get_syncdbs(): pkg = repo.get_pkg(pkgname) if pkg: #print("adding %s" % pkgname) self.t.add_pkg(pkg) break else: #this is used for groups. However, cinnarch repo coming # first causes errors. So I just moved them to the back. l = pyalpm.find_grp_pkgs([repo], pkgname) if l: lss = [] for pakg in l: self.t.add_pkg(pakg) except pyalpm.error: line = traceback.format_exc() self.queue_event("error", line)
def test_find_grp_pkgs_error(): with pytest.raises(TypeError) as excinfo: pyalpm.find_grp_pkgs() assert 'expected arguments' in str(excinfo.value)
def test_find_grp_pkgs(syncdb): assert pyalpm.find_grp_pkgs([syncdb], 'test') == []
continue if attr == "files": print(" ", len(pkg.files), "files") else: print(" ", attr, ":", getattr(pkg, attr)) print(" Required by:", ' '.join(pkg.compute_requiredby())) print("") print("Package information about a tarball") for i in os.listdir("/var/cache/pacman/pkg"): filename = os.path.join("/var/cache/pacman/pkg", i) pkg = h.load_pkg(filename) print("Loaded", filename) break for attr in dir(pkg): if attr.startswith('_'): continue if attr == "files": print(" ", len(pkg.files), "files") else: print(" ", attr, ":", getattr(pkg, attr)) print("") print("Information about group gnome") l = pyalpm.find_grp_pkgs([core, extra, community], "gnome") for pkg in l: print(" ", pkg.name, "from", pkg.db.name) print("") # vim: set ts=4 sw=4 et: