Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/48124 )
Change subject: scons: Eliminate the SourceFile.basename property.
......................................................................
scons: Eliminate the SourceFile.basename property.
This value is used in only two places, and can be calculated in place to
avoid complexity.
Change-Id: I1e59b92521250b3f5a3e2cba599236ededf1761d
---
M src/SConscript
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/SConscript b/src/SConscript
index 3173a30..9e5471d 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -48,7 +48,7 @@
import sys
import zlib
-from os.path import basename, dirname, exists, isdir, isfile, join as
joinpath
+from os.path import dirname, exists, isdir, isfile, join as joinpath
import SCons
@@ -275,10 +275,6 @@
self.shared_objs[key] = env.SharedObject(self.tnode)
return self.shared_objs[key]
- @property
- def basename(self):
- return basename(self.filename)
-
def __lt__(self, other): return self.filename < other.filename
def __le__(self, other): return self.filename <= other.filename
def __gt__(self, other): return self.filename > other.filename
@@ -375,7 +371,8 @@
'''specify the python package, the source file, and any tags'''
super(PySource, self).__init__(source, tags, add_tags)
- modname, ext = os.path.splitext(self.basename)
+ basename = os.path.basename(self.filename)
+ modname, ext = os.path.splitext(basename)
assert ext == '.py'
if package:
@@ -388,7 +385,7 @@
modpath += [ modname ]
modpath = '.'.join(modpath)
- arcpath = path + [ self.basename ]
+ arcpath = path + [ basename ]
abspath = self.snode.abspath
if not exists(abspath):
abspath = self.tnode.abspath
@@ -461,7 +458,8 @@
error('Got protobuf to build, but lacks support!')
# Get the file name and the extension
- modname, ext = os.path.splitext(self.basename)
+ basename = os.path.basename(self.filename)
+ modname, ext = os.path.splitext(basename)
assert ext == '.proto'
self.cc_file, self.hh_file = env.ProtoBufCC(source=source)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48124
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: I1e59b92521250b3f5a3e2cba599236ededf1761d
Gerrit-Change-Number: 48124
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
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