Gabe Black has uploaded this change for review. (
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
---
M src/SConscript
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/src/SConscript b/src/SConscript
index 354b528..8c36374 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)
--
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: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s