Skip to content

Commit a2c42a1

Browse files
author
Gabe Black
committed
scons,python: Stop importing some values in m5.defines.
The compileDate and gem5Version fields are used in only one place, gem5's python main function. These fields are the remaining difference between the "fake" defines.py provided by the SimObject importer, and the real one composed later. It makes sense to exclude them in the "fake" version since those values come from c++, but it would feel like an arbitrary and unexpected difference to people trying to use it. Change-Id: Ie344765bf7c8063197da24f5b55f762379deff94 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48380 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com>
1 parent ad1f240 commit a2c42a1

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/SConscript

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -693,14 +693,7 @@ def makeDefinesPyFile(target, source, env):
693693
build_env = source[0].get_contents().decode('utf-8')
694694

695695
code = code_formatter()
696-
code("""
697-
import _m5.core
698-
699-
buildEnv = dict($build_env)
700-
701-
compileDate = _m5.core.compileDate
702-
gem5Version = _m5.core.gem5Version
703-
""")
696+
code("buildEnv = dict($build_env)")
704697
code.write(target[0].abspath)
705698

706699
defines_info = Value(build_env)

src/python/m5/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def _check_tracing():
214214

215215
def main(*args):
216216
import m5
217+
import _m5.core
217218

218219
from . import core
219220
from . import debug
@@ -336,8 +337,8 @@ def main(*args):
336337
print(brief_copyright)
337338
print()
338339

339-
print("gem5 version %s" % defines.gem5Version)
340-
print("gem5 compiled %s" % defines.compileDate)
340+
print("gem5 version %s" % _m5.core.gem5Version)
341+
print("gem5 compiled %s" % _m5.core.compileDate)
341342

342343
print("gem5 started %s" %
343344
datetime.datetime.now().strftime("%b %e %Y %X"))

0 commit comments

Comments
 (0)