def equals(self, other): if self.name != other.name or self.version != other.version: return False if Package.equals(self, other): return True fk = dict.fromkeys if (len(self.upgrades) != len(other.upgrades) or len(self.conflicts) != len(other.conflicts)): return False supgs = fk(self.upgrades) oupgs = fk(other.upgrades) if supgs != oupgs: for supg in supgs: if supg in oupgs: continue for oupg in oupgs: if (supg.name == oupg.name and checkver(supg.version, oupg.version)): break else: return False for oupg in oupgs: if oupg in supgs: continue for supg in supgs: if (supg.name == oupg.name and checkver(supg.version, oupg.version)): break else: return False scnfs = fk(self.conflicts) ocnfs = fk(other.conflicts) if scnfs != ocnfs: for scnf in scnfs: if scnf in ocnfs: continue for ocnf in ocnfs: if (scnf.name == ocnf.name and checkver(scnf.version, ocnf.version)): break else: return False for ocnf in ocnfs: if ocnf in scnfs: continue for scnf in scnfs: if (scnf.name == ocnf.name and checkver(scnf.version, ocnf.version)): break else: return False sprvs = fk(self.provides) oprvs = fk(other.provides) if sprvs != oprvs: for sprv in sprvs: if not sprv.name or sprv.name[0] == "/" or sprv in oprvs: continue for oprv in oprvs: if (sprv.name == oprv.name and checkver(sprv.version, oprv.version)): break else: return False for oprv in oprvs: if not oprv.name or oprv.name[0] == "/" or oprv in sprvs: continue for sprv in sprvs: if (sprv.name == oprv.name and checkver(sprv.version, oprv.version)): break else: return False sreqs = fk(self.requires) oreqs = fk(other.requires) if sreqs != oreqs: for sreq in sreqs: if sreq.name[0] == "/" or sreq in oreqs: continue for oreq in oreqs: if (sreq.name == oreq.name and sreq.relation == oreq.relation and checkver(sreq.version, oreq.version)): break else: return False for oreq in oreqs: if oreq.name[0] == "/" or oreq in sreqs: continue for sreq in sreqs: if (sreq.name == oreq.name and sreq.relation == oreq.relation and checkver(sreq.version, oreq.version)): break else: return False srecs = fk(self.recommends) orecs = fk(other.recommends) if srecs != orecs: for srec in srecs: if srec.name[0] == "/" or srec in orecs: continue for orec in orecs: if (srec.name == orec.name and srec.relation == orec.relation and checkver(srec.version, orec.version)): break else: return False for orec in orecs: if orec.name[0] == "/" or orec in srecs: continue for srec in srecs: if (srec.name == orec.name and srec.relation == orec.relation and checkver(srec.version, orec.version)): break else: return False return True