From 71accb5f7802903267b7c47dc8efc626f7f91627 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 3 Dec 2017 00:56:36 -0800 Subject: scons: Several fixes having to do with tags and sets. There were a few places where tags weren't being converted to sets correctly which unfortunately only manifested when called in certain ways. This would be a pretty reasonable place to add some python unit tests... Change-Id: I87509369b4ec6f702b7521e52bf63701a87ec436 Reviewed-on: https://gem5-review.googlesource.com/6261 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/SConscript | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/SConscript b/src/SConscript index 88903088d..961df49d9 100755 --- a/src/SConscript +++ b/src/SConscript @@ -71,11 +71,11 @@ class SourceList(list): def with_any_tags(self, *tags): '''Return a list of sources with any of the supplied tags.''' - return self.with_tags_that(lambda stags: len(tags & stags) > 0) + return self.with_tags_that(lambda stags: len(set(tags) & stags) > 0) def with_all_tags(self, *tags): '''Return a list of sources with all of the supplied tags.''' - return self.with_tags_that(lambda stags: tags <= stags) + return self.with_tags_that(lambda stags: set(tags) <= stags) def with_tag(self, tag): '''Return a list of sources with the supplied tag.''' @@ -83,7 +83,7 @@ class SourceList(list): def without_tags(self, *tags): '''Return a list of sources without any of the supplied tags.''' - return self.with_tags_that(lambda stags: len(tags & stags) == 0) + return self.with_tags_that(lambda stags: len(set(tags) & stags) == 0) def without_tag(self, tag): '''Return a list of sources with the supplied tag.''' @@ -111,11 +111,16 @@ class SourceFile(object): tags='gem5 lib' if isinstance(tags, basestring): tags = set([tags]) - if isinstance(add_tags, basestring): - add_tags = set([add_tags]) + if not isinstance(tags, set): + tags = set(tags) + self.tags = tags + if add_tags: - tags = tags | add_tags - self.tags = set(tags) + if isinstance(add_tags, basestring): + add_tags = set([add_tags]) + if not isinstance(add_tags, set): + add_tags = set(add_tags) + self.tags |= add_tags tnode = source if not isinstance(source, SCons.Node.FS.File): -- cgit v1.2.3