Implement Manifest2Entry.__ne__() so that comparisons inside Manifest.write()
authorZac Medico <zmedico@gentoo.org>
Sat, 31 Jan 2009 20:43:26 +0000 (20:43 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 31 Jan 2009 20:43:26 +0000 (20:43 -0000)
work properly (to avoid rewriting an identical manifest when possible).

svn path=/main/trunk/; revision=12567

pym/portage/manifest.py

index 0fc0a6b4a2a2c28719a005549685c2a76bc52c9c..9329c889b3f827997b8babf4701c17e4880043f5 100644 (file)
@@ -66,6 +66,17 @@ class Manifest2Entry(ManifestEntry):
                        myline += " " + h + " " + str(self.hashes[h])
                return myline
 
+       def __eq__(self, other):
+               if not isinstance(other, Manifest2Entry) or \
+                       self.type != other.type or \
+                       self.name != other.name or \
+                       self.hashes != other.hashes:
+                       return False
+               return True
+
+       def __ne__(self, other):
+               return not self.__eq__(other)
+
 class Manifest(object):
        parsers = (parseManifest2,)
        def __init__(self, pkgdir, distdir, fetchlist_dict=None,