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

Change subject: scons: Some minor simplification of code in SConstruct.
......................................................................

scons: Some minor simplification of code in SConstruct.

Collapse away a function which was called exactly once, and take
advantage of the fact that the "in" operator checks if a key exists in
dictionaries (and also SCons environments).

Change-Id: I929b7e847be000642d6a373deb50a54fd5241df6
---
M SConstruct
1 file changed, 16 insertions(+), 23 deletions(-)



diff --git a/SConstruct b/SConstruct
index 1b76fe5..c281174 100755
--- a/SConstruct
+++ b/SConstruct
@@ -134,10 +134,8 @@
 from gem5_scons.util import get_termcap
 termcap = get_termcap()

-main_dict_keys = main.Dictionary().keys()
-
 # Check that we have a C/C++ compiler
-if not ('CC' in main_dict_keys and 'CXX' in main_dict_keys):
+if not ('CC' in main and 'CXX' in main):
     error("No C++ compiler installed (package g++ on Ubuntu and RedHat)")

 ###################################################
@@ -147,26 +145,21 @@
 #
 ###################################################

-# Find default configuration & binary.
-Default(environ.get('M5_DEFAULT_BINARY', 'build/ARM/gem5.debug'))
-
-# Take a list of paths (or SCons Nodes) and return a list with all
-# paths made absolute and ~-expanded.  Paths will be interpreted
-# relative to the launch directory unless a different root is provided
-def makePathListAbsolute(path_list, root=GetLaunchDir()):
-    return [abspath(os.path.join(root, expanduser(str(p))))
-            for p in path_list]
-
-# Each target must have 'build' in the interior of the path; the
-# directory below this will determine the build parameters.  For
-# example, for target 'foo/bar/build/X86/arch/x86/blah.do' we
-# recognize that X86 specifies the configuration because it
-# follow 'build' in the build path.
-
-# The funky assignment to "[:]" is needed to replace the list contents
-# in place rather than reassign the symbol to a new list, which
-# doesn't work (obviously!).
-BUILD_TARGETS[:] = makePathListAbsolute(BUILD_TARGETS)
+# Each target must have 'build' in the interior of the path; the directory
+# below this will determine the build parameters.  For example, for target
+# 'foo/bar/build/X86/arch/x86/blah.do' we recognize that X86 specifies the
+# configuration because it follow 'build' in the build path.
+#
+# Take a list of paths (or SCons Nodes) and return a list with all paths made +# absolute and ~-expanded. Paths will be interpreted relative to the launch
+# directory unless a different root is provided
+#
+# The funky assignment to "[:]" is needed to replace the list contents in
+# place rather than reassign the symbol to a new list, which doesn't work
+# (obviously!).
+BUILD_TARGETS[:] = \
+        [ abspath(os.path.join(GetLaunchDir(), expanduser(str(p)))) for
+                p in BUILD_TARGETS ]

 # Generate a list of the unique build roots and configs that the
 # collected targets reference.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40876
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: I929b7e847be000642d6a373deb50a54fd5241df6
Gerrit-Change-Number: 40876
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to