scons: Simplify the PySource class slightly.

Demote the cpp attribute to a local variable, and get rid of the unused
"package" attribute.

Change-Id: I190792274ea9bdd9853aa3b6e07ce4151b378251
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49388
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
This commit is contained in:
Gabe Black
2021-08-05 00:02:10 -07:00
parent 0b06c55520
commit 6bbaceca91

View File

@@ -160,24 +160,24 @@ class PySource(SourceFile):
if not os.path.exists(abspath):
abspath = self.tnode.abspath
self.package = package
self.modname = modname
self.modpath = modpath
self.abspath = abspath
self.cpp = File(self.filename + '.cc')
PySource.modules[modpath] = self
cpp = File(self.filename + '.cc')
overrides = {
'PYSOURCE_MODPATH': modpath,
'PYSOURCE_ABSPATH': abspath,
}
marshal_env.Command(self.cpp, [ py_marshal, File(source) ],
marshal_env.Command(cpp, [ py_marshal, File(source) ],
MakeAction(embedPyFile, Transform("EMBED PY"),
varlist=overrides.keys()),
**overrides)
if main['USE_PYTHON']:
Source(self.cpp, tags=self.tags, add_tags='python')
Source(cpp, tags=self.tags, add_tags='python')
class SimObject(PySource):
'''Add a SimObject python file as a python source object and add