Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/48122 )
Change subject: scons: Replace the extname property with os.path.splitext().
......................................................................
scons: Replace the extname property with os.path.splitext().
This is almost exactly the same, except it leaves the "." on the
extension, and returns an empty string instead of None if there is no
extension.
Change-Id: Idb540771007f9f7ca8aafdb09512eb1219010237
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48122
Maintainer: Gabe Black <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
---
M src/SConscript
1 file changed, 5 insertions(+), 13 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/SConscript b/src/SConscript
index a4b35cd..1565cd3 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -43,6 +43,7 @@
import functools
import imp
import os
+import os.path
import re
import sys
import zlib
@@ -281,15 +282,6 @@
def basename(self):
return basename(self.filename)
- @property
- def extname(self):
- index = self.basename.rfind('.')
- if index <= 0:
- # dot files aren't extensions
- return self.basename, None
-
- return self.basename[:index], self.basename[index+1:]
-
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
@@ -386,8 +378,8 @@
'''specify the python package, the source file, and any tags'''
super(PySource, self).__init__(source, tags, add_tags)
- modname,ext = self.extname
- assert ext == 'py'
+ modname, ext = os.path.splitext(self.basename)
+ assert ext == '.py'
if package:
path = package.split('.')
@@ -472,8 +464,8 @@
error('Got protobuf to build, but lacks support!')
# Get the file name and the extension
- modname,ext = self.extname
- assert ext == 'proto'
+ modname, ext = os.path.splitext(self.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/+/48122
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: Idb540771007f9f7ca8aafdb09512eb1219010237
Gerrit-Change-Number: 48122
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.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