[llvm] r187859 - [lit] Avoid __cmp__ and cmp().

Daniel Dunbar daniel at zuster.org
Tue Aug 6 20:22:02 PDT 2013


Author: ddunbar
Date: Tue Aug  6 22:22:02 2013
New Revision: 187859

URL: http://llvm.org/viewvc/llvm-project?rev=187859&view=rev
Log:
[lit] Avoid __cmp__ and cmp().

Modified:
    llvm/trunk/utils/lit/lit/ShCommands.py

Modified: llvm/trunk/utils/lit/lit/ShCommands.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ShCommands.py?rev=187859&r1=187858&r2=187859&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/ShCommands.py (original)
+++ llvm/trunk/utils/lit/lit/ShCommands.py Tue Aug  6 22:22:02 2013
@@ -6,12 +6,12 @@ class Command:
     def __repr__(self):
         return 'Command(%r, %r)' % (self.args, self.redirects)
 
-    def __cmp__(self, other):
+    def __eq__(self, other):
         if not isinstance(other, Command):
-            return -1
+            return False
 
-        return cmp((self.args, self.redirects),
-                   (other.args, other.redirects))
+        return ((self.args, self.redirects) ==
+                (other.args, other.redirects))
 
     def toShell(self, file):
         for arg in self.args:
@@ -45,12 +45,12 @@ class Pipeline:
         return 'Pipeline(%r, %r, %r)' % (self.commands, self.negate,
                                          self.pipe_err)
 
-    def __cmp__(self, other):
+    def __eq__(self, other):
         if not isinstance(other, Pipeline):
-            return -1
+            return False
 
-        return cmp((self.commands, self.negate, self.pipe_err),
-                   (other.commands, other.negate, self.pipe_err))
+        return ((self.commands, self.negate, self.pipe_err) ==
+                (other.commands, other.negate, self.pipe_err))
 
     def toShell(self, file, pipefail=False):
         if pipefail != self.pipe_err:
@@ -72,12 +72,12 @@ class Seq:
     def __repr__(self):
         return 'Seq(%r, %r, %r)' % (self.lhs, self.op, self.rhs)
 
-    def __cmp__(self, other):
+    def __eq__(self, other):
         if not isinstance(other, Seq):
-            return -1
+            return False
 
-        return cmp((self.lhs, self.op, self.rhs),
-                   (other.lhs, other.op, other.rhs))
+        return ((self.lhs, self.op, self.rhs) ==
+                (other.lhs, other.op, other.rhs))
 
     def toShell(self, file, pipefail=False):
         self.lhs.toShell(file, pipefail)





More information about the llvm-commits mailing list