scons: Tidy up the definition of SourceFile slightly.

Use {} notation for creating a set, and rely on the fact that applying
File() to something that already is does nothing.

Change-Id: I2ec99e4a4859df9a0a88bcc38e93233841124de6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48373
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Gabe Black
2021-07-19 17:46:25 -07:00
parent d73e4b789e
commit 4b86614d31

View File

@@ -230,23 +230,21 @@ class SourceFile(object, metaclass=SourceMeta):
if tags is None:
tags='gem5 lib'
if isinstance(tags, str):
tags = set([tags])
tags = { tags }
if not isinstance(tags, set):
tags = set(tags)
self.tags = tags
if add_tags:
if isinstance(add_tags, str):
add_tags = set([add_tags])
add_tags = { add_tags }
if not isinstance(add_tags, set):
add_tags = set(add_tags)
self.tags |= add_tags
self.append = append
tnode = source
if not isinstance(source, SCons.Node.FS.File):
tnode = File(source)
tnode = File(source)
self.tnode = tnode
self.filename = str(self.tnode)