Implement Manifest2Entry.__ne__() so that comparisons inside Manifest.write()
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:31:39 +0000 (03:31 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:31:39 +0000 (03:31 -0000)
work properly (to avoid rewriting an identical manifest when possible).
(trunk r12567)

svn path=/main/branches/2.1.6/; revision=12848

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,