[gem5-dev] Change in gem5/gem5[develop]: scons: Replace the extname property with os.path.splitext().

2021-08-05 Thread Gabe Black (Gerrit) via gem5-dev
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 
Tested-by: kokoro 
Reviewed-by: Daniel Carvalho 
---
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 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: scons: Replace the extname property with os.path.splitext().

2021-07-15 Thread Gabe Black (Gerrit) via gem5-dev
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 
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