diff options
author | Gabe Black <gabeblack@google.com> | 2017-12-03 00:56:36 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2017-12-06 01:07:03 +0000 |
commit | 71accb5f7802903267b7c47dc8efc626f7f91627 (patch) | |
tree | 744ef0a19504483d4aee56b072e04d9d7aa23692 /src/SConscript | |
parent | 0b11c2ea6d188077b04effe8b80c193fa74c2ca3 (diff) | |
download | gem5-71accb5f7802903267b7c47dc8efc626f7f91627.tar.xz |
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 <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/SConscript')
-rwxr-xr-x | src/SConscript | 19 |
1 files 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): |