scons: Replace the SourceFile.filename property with attribute.

The SourceFile.filename property dynamically calculated the str()
conversion of self.tnode. Since self.tnode shouldn't be changed, it
doesn't seem useful to calculate that value over and over, especially
since it adds some extra indirection and magic to something that's
really pretty simple.

Change-Id: Ia0e1e8f4b0c019a026a08b5c2730d93c66de8190
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48123
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-07-09 22:51:47 -07:00
parent 14f2bfe389
commit b159756d1c

View File

@@ -250,6 +250,7 @@ class SourceFile(object, metaclass=SourceMeta):
tnode = File(source)
self.tnode = tnode
self.filename = str(self.tnode)
self.snode = tnode.srcnode()
for base in type(self).__mro__:
@@ -274,10 +275,6 @@ class SourceFile(object, metaclass=SourceMeta):
self.shared_objs[key] = env.SharedObject(self.tnode)
return self.shared_objs[key]
@property
def filename(self):
return str(self.tnode)
@property
def basename(self):
return basename(self.filename)