scons: Pull info.py generation out of SConscript and into build_tools.

Change-Id: I36e21901741a61673198011ce3889982e19f37f4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49404
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Gabe Black
2021-08-15 03:00:13 -07:00
parent 4a2b4f162b
commit c594bf8e24
2 changed files with 66 additions and 12 deletions

View File

@@ -633,19 +633,14 @@ env.Command('python/m5/defines.py', ToValue(dict(build_env)),
MakeAction(makeDefinesPyFile, Transform("DEFINES", 0)))
PySource('m5', 'python/m5/defines.py')
# Generate python file containing info about the M5 source code
def makeInfoPyFile(target, source, env):
code = code_formatter()
for src in source:
with open(src.srcnode().abspath, 'r') as f:
data = ''.join(f)
code('$src = ${{repr(data)}}')
code.write(str(target[0]))
# Generate a file that wraps the basic top level files
env.Command('python/m5/info.py',
[ '#/COPYING', '#/LICENSE', '#/README', ],
MakeAction(makeInfoPyFile, Transform("INFO")))
gem5py_env.Command('python/m5/info.py',
[ File('#/COPYING'), File('#/LICENSE'), File('#/README'),
"${GEM5PY}", "${INFOPY_PY}" ],
MakeAction('"${GEM5PY}" "${INFOPY_PY}" "${TARGET}" '
'${SOURCES[:-2]}',
Transform("INFO", 3)),
INFOPY_PY=build_tools.File('infopy.py'))
PySource('m5', 'python/m5/info.py')
########################################################################