From 2d4d155e0a92175dea2fed8ccbd512f60e4d4a3d Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 13 Sep 2004 22:04:43 +0000 Subject: [PATCH] Fix Action comparison when a Builder has a suffix key of None. (Kevin Quick) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1064 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Action.py | 2 +- src/engine/SCons/ActionTests.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 2cd23f4b..63d8c987 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -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") diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index c6201e2e..a61571eb 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -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() -- 2.26.2