Commits

Burcin Erocal committed e602fe7

Add string based hash function to dependency classes.

Comments (0)

Files changed (1)

gentoopm/basepm/depend.py

 		return '%s(\n%s)' % (self.__class__.__name__,
 				',\n'.join(l))
 
+	def __hash__(self):
+		return hash(str(self))
+
+	def __eq__(left, right):
+		if not (isinstance(left, PMBaseDep) and isinstance(right, PMBaseDep)):
+			return False
+		return str(left) == str(right)
+
 class PMUncondBaseDep(PMBaseDep):
 	def __init__(self, parent):
 		self._parent = parent