Fix Action comparison when a Builder has a suffix key of None. (Kevin Quick)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 13 Sep 2004 22:04:43 +0000 (22:04 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 13 Sep 2004 22:04:43 +0000 (22:04 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1064 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Action.py
src/engine/SCons/ActionTests.py

index 2cd23f4bb5d6d590e6a02da3a2f370c38a78221d..63d8c9870d419ba66e440f9cebf316e8dcfa135a 100644 (file)
@@ -216,7 +216,7 @@ class ActionBase:
             self.presub = presub
 
     def __cmp__(self, other):
-        return cmp(self.__dict__, other.__dict__)
+        return cmp(self.__dict__, other)
 
     def print_cmd_line(self, s, target, source, env):
         sys.stdout.write(s + "\n")
index c6201e2e8d7352701d5b972457f13c0df5491ab3..a61571eb065924b799ecb02b2674b8b11a564548 100644 (file)
@@ -1583,6 +1583,27 @@ class ActionCompareTestCase(unittest.TestCase):
         name = bar.get_name(env)
         assert name == 'BAR', name
 
+    def test_3_dict_names(self):
+        """Test Action/Suffix dicts with get_name.
+
+        Verifies that Action/Suffix dictionaries work correctly,
+        especially two builders that can generate the same suffix,
+        where one of the builders has a suffix dictionary with a None
+        key."""
+        
+        foo = SCons.Builder.Builder(action = '$FOO', suffix = '.foo')
+        bar = SCons.Builder.Builder(action = {}, suffix={None:'.bar'})
+        bar.add_action('.cow', "$MOO")
+        dog = SCons.Builder.Builder(suffix = '.bar')
+        
+        env = Environment( BUILDERS = {'FOO' : foo,
+                                       'BAR' : bar,
+                                       'DOG' : dog} )
+        
+        assert foo.get_name(env) == 'FOO'
+        assert bar.get_name(env) == 'BAR'
+        assert dog.get_name(env) == 'DOG'
+
 
 if __name__ == "__main__":
     suite = unittest.TestSuite()