Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40965 )

Change subject: scons: Stop piggy-backing on the default tool for default settings.
......................................................................

scons: Stop piggy-backing on the default tool for default settings.

Instead, create a new tool called EnvDefaults. This tool now needs
to be explicitly listed in the set of tools available through an
Environment, but that's easy to do in on place (all environments should
stem from main). Hijacking default like we were doing was (as far as I
can tell) not how that tool was intended to be used, and doing things
this way is a bit less hacky.

Also, we can split more Builders, etc, out of SConstruct, and these will
need to attach to main in the same way. We're going to need a list of
tools when main is constructed one way or the other, so we might as well
follow the rules.

Change-Id: I392e1639cb69d373c64970dccf45258000498cc3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40965
Reviewed-by: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
Maintainer: Bobby R. Bruce <[email protected]>
---
M SConstruct
M site_scons/gem5_scons/__init__.py
R site_scons/gem5_scons/defaults.py
3 files changed, 8 insertions(+), 15 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/SConstruct b/SConstruct
index 021883b..a146115 100755
--- a/SConstruct
+++ b/SConstruct
@@ -121,7 +121,7 @@
           help='Build systemc tests')

 from gem5_scons import Transform, error, warning, summarize_warnings
-from gem5_scons import TempFileSpawn, parse_build_path
+from gem5_scons import TempFileSpawn, parse_build_path, EnvDefaults
 import gem5_scons

 ########################################################################
@@ -130,7 +130,7 @@
 #
 ########################################################################

-main = Environment(tools=['default', 'git', TempFileSpawn])
+main = Environment(tools=['default', 'git', TempFileSpawn, EnvDefaults])

 main.Tool(SCons.Tool.FindTool(['gcc', 'clang'], main))
 main.Tool(SCons.Tool.FindTool(['g++', 'clang++'], main))
diff --git a/site_scons/gem5_scons/__init__.py b/site_scons/gem5_scons/__init__.py
index 6b167af..ae407fb 100644
--- a/site_scons/gem5_scons/__init__.py
+++ b/site_scons/gem5_scons/__init__.py
@@ -45,6 +45,7 @@

 from gem5_scons.util import get_termcap
 from gem5_scons.configure import Configure
+from gem5_scons.defaults import EnvDefaults
 import SCons.Script

 termcap = get_termcap()
@@ -237,4 +238,7 @@

     return os.path.join('/', *path_dirs), variant_dir

-__all__ = ['Configure', 'Transform', 'warning', 'error', 'parse_build_dir']
+__all__ = [
+        'Configure', 'EnvDefaults', 'Transform', 'warning', 'error',
+        'parse_build_dir'
+]
diff --git a/site_scons/site_tools/default.py b/site_scons/gem5_scons/defaults.py
similarity index 94%
rename from site_scons/site_tools/default.py
rename to site_scons/gem5_scons/defaults.py
index 305a2a2..e59b40f 100644
--- a/site_scons/site_tools/default.py
+++ b/site_scons/gem5_scons/defaults.py
@@ -39,14 +39,10 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 import os
-import sys
-
-import SCons.Tool
-import SCons.Tool.default

 from gem5_python_paths import extra_python_paths

-def common_config(env):
+def EnvDefaults(env):
     # export TERM so that clang reports errors in color
     use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
                      'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
@@ -75,10 +71,3 @@
     # add useful python code PYTHONPATH so it can be used by subprocesses
     # as well
     env.AppendENVPath('PYTHONPATH', extra_python_paths)
-
-def generate(env):
-    common_config(env)
-    SCons.Tool.default.generate(env)
-
-def exists(env):
-    return 1

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40965
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: I392e1639cb69d373c64970dccf45258000498cc3
Gerrit-Change-Number: 40965
Gerrit-PatchSet: 18
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
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