Gabe Black has submitted this change. ( 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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48124
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/SConscript
1 file changed, 6 insertions(+), 8 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, but someone else must approve
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/SConscript b/src/SConscript
index 53df4f5..df87950 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)



2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
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: 4
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
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

Reply via email to