summaryrefslogtreecommitdiffstats
path: root/SCons/Environment.py
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2021-01-05 21:39:19 (GMT)
committerAdam Gross <grossag@vmware.com>2021-01-05 21:39:19 (GMT)
commit97d424e9d5094127a04382de9339cf4db3ab5e8e (patch)
tree102b9c34f47e210aa6053e7d3b7690ab4545e36c /SCons/Environment.py
parentf5a7ae701a6a8ee898236fa0c996101cf9814483 (diff)
downloadSCons-97d424e9d5094127a04382de9339cf4db3ab5e8e.zip
SCons-97d424e9d5094127a04382de9339cf4db3ab5e8e.tar.gz
SCons-97d424e9d5094127a04382de9339cf4db3ab5e8e.tar.bz2
Fix bug where SideEffect() was returning duplicate entries
My code was adding the side effect to the return list inside of a "for target in targets" loop, causing duplicate entries if there were multiple targets. Fix this by adding outside of the loop.
Diffstat (limited to 'SCons/Environment.py')
-rw-r--r--SCons/Environment.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/SCons/Environment.py b/SCons/Environment.py
index 0c1315c..3b720c8 100644
--- a/SCons/Environment.py
+++ b/SCons/Environment.py
@@ -2256,10 +2256,13 @@ class Base(SubstitutionEnvironment):
side_effect.add_source(targets)
side_effect.side_effect = 1
self.Precious(side_effect)
+ added = False
for target in targets:
if side_effect not in target.side_effects:
target.side_effects.append(side_effect)
- added_side_effects.append(side_effect)
+ added = True
+ if added:
+ added_side_effects.append(side_effect)
return added_side_effects
def Split(self, arg):