Yen-lin Lai has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/58409 )
Change subject: scons: Allow sources and libs called multiple times
......................................................................
scons: Allow sources and libs called multiple times
In Python, "+=" operator for list acts more like append and list assign
doesn't make a copy. This will cause unexpected append to the orignal
list. Since we have multiple env to "declare", these functions will be
called multiple times and could wrongly append duplicated entries in
later calls.
Make a copy before appending the entries from filter to avoid this
problem.
Change-Id: I144d5054e4d93191ebc94b93291ff9a3f8a6c429
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58409
Reviewed-by: Yu-hsin Wang <yuhsi...@google.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/SConscript
1 file changed, 25 insertions(+), 2 deletions(-)
Approvals:
Yu-hsin Wang: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/SConscript b/src/SConscript
index d55520b..746d3f1 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -38,6 +38,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import collections
+import copy
import distutils.spawn
import itertools
import os
@@ -329,13 +330,13 @@
self.dir = Dir('.')
def sources(self, env):
- srcs = self.srcs
+ srcs = copy.copy(self.srcs)
for f in self.filters:
srcs += Source.all.apply_filter(env, f)
return srcs
def libs(self, env):
- libs = self.sourceLibs
+ libs = copy.copy(self.sourceLibs)
for f in self.filters:
libs += SourceLib.all.apply_filter(env, f)
return libs
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/58409
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I144d5054e4d93191ebc94b93291ff9a3f8a6c429
Gerrit-Change-Number: 58409
Gerrit-PatchSet: 2
Gerrit-Owner: Yen-lin Lai <yenlin...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Yen-lin Lai <yenlin...@google.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s