Use a SCons.Util.UniqueList instance for the Executor.sources list
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 1 Jan 2009 18:36:15 +0000 (18:36 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 1 Jan 2009 18:36:15 +0000 (18:36 +0000)
instead of maintaining its uniqueness by hand.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@3869 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Executor.py
src/engine/SCons/ExecutorTests.py

index 6b9ab0f4ba10d72d722c4906bce67ea4f89df4dc..25db7711f1b770261f6f8fe8d7c8d09cf64ac04e 100644 (file)
@@ -59,8 +59,7 @@ class Executor:
         self.env = env
         self.overridelist = overridelist
         self.targets = targets
-        self.sources = sources[:]
-        self.sources_need_sorting = False
+        self.sources = SCons.Util.UniqueList(sources[:])
         self.builder_kw = builder_kw
         self._memo = {}
 
@@ -156,12 +155,8 @@ class Executor:
         for "multi" Builders that can be called repeatedly to build up
         a source file list for a given target."""
         self.sources.extend(sources)
-        self.sources_need_sorting = True
 
     def get_sources(self):
-        if self.sources_need_sorting:
-            self.sources = SCons.Util.uniquer_hashables(self.sources)
-            self.sources_need_sorting = False
         return self.sources
 
     def prepare(self):
index 12c80b4cedf51f12834afcd0f688355c39c5ad02..0fd11af6a391d91971a59c637e979853eef3bc69 100644 (file)
@@ -160,12 +160,12 @@ class ExecutorTestCase(unittest.TestCase):
 
         env = MyEnvironment(Y='yyy')
         overrides = [{'O':'ob3'}, {'O':'oo3'}]
-        x = SCons.Executor.Executor(MyAction(), env, overrides, 't', 's')
+        x = SCons.Executor.Executor(MyAction(), env, overrides, ['t'], ['s'])
         be = x.get_build_env()
         assert be['O'] == 'oo3', be['O']
         assert be['Y'] == 'yyy', be['Y']
         overrides = [{'O':'ob3'}]
-        x = SCons.Executor.Executor(MyAction(), env, overrides, 't', 's')
+        x = SCons.Executor.Executor(MyAction(), env, overrides, ['t'], ['s'])
         be = x.get_build_env()
         assert be['O'] == 'ob3', be['O']
         assert be['Y'] == 'yyy', be['Y']
@@ -270,9 +270,9 @@ class ExecutorTestCase(unittest.TestCase):
         x = SCons.Executor.Executor('b', 'e', 'o', 't', ['s1', 's2'])
         assert x.sources == ['s1', 's2'], x.sources
         x.add_sources(['s1', 's2'])
-        assert x.sources == ['s1', 's2', 's1', 's2'], x.sources
+        assert x.sources == ['s1', 's2'], x.sources
         x.add_sources(['s3', 's1', 's4'])
-        assert x.sources == ['s1', 's2', 's1', 's2', 's3', 's1', 's4'], x.sources
+        assert x.sources == ['s1', 's2', 's3', 's4'], x.sources
 
     def test_get_sources(self):
         """Test getting sources from an Executor"""