Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/58354 )

Change subject: scons: Rework the fastmodel extract_var helper.
......................................................................

scons: Rework the fastmodel extract_var helper.

This helper extracts config variables and sets them up for use in
fast model tools. Rework this function for two purposes. First, ensure
that the ['CONF'] subdict is used consistently. It was used in one spot
in that function, but not anywhere else. Avoid those mistakes by
accessing the configuration dict only once, and then reusing the value.

Second, only print the values of those variables if they aren't empty.
That avoids extra log output for values which aren't set up and aren't
being used, while still exposing those values if they are set up. This
will print them even if they aren't being actively used, but are set up
and could be with other changes in the config.

Change-Id: Ia3ea76e6cb6b3347fd082112a1eaa8d594e06ca2
---
M src/arch/arm/fastmodel/SConscript
1 file changed, 28 insertions(+), 5 deletions(-)



diff --git a/src/arch/arm/fastmodel/SConscript b/src/arch/arm/fastmodel/SConscript
index 884f970..5226a78 100644
--- a/src/arch/arm/fastmodel/SConscript
+++ b/src/arch/arm/fastmodel/SConscript
@@ -61,13 +61,15 @@
 env['ENV']['SYSTEMC_HOME'] = systemc_home.abspath

 def extract_var(name):
-    if name not in env['CONF']:
-        error('Error: %s is not set' % name)
-    print('%s = %s' % (name, env[name]))
+    val = env['CONF'].get(name, None)
+    if val is None:
+        error('%s is not set' % name)
+    if val:
+        print('%s = %s' % (name, env['CONF'][name]))
# Make sure the value of this variable shows up as an environment variable
     # for commands scons runs.
-    env['ENV'][name] = env[name]
-    return env[name]
+    env['ENV'][name] = val
+    return val

 pvlib_home, maxcore_home, armlmd_license_file = \
     list(map(extract_var, ('PVLIB_HOME', 'MAXCORE_HOME',

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/58354
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: Ia3ea76e6cb6b3347fd082112a1eaa8d594e06ca2
Gerrit-Change-Number: 58354
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
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

Reply via email to