Yu-hsin Wang has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/38575 )
Change subject: scons: move version detection to real Scons entrypoint
......................................................................
scons: move version detection to real Scons entrypoint
scons 4.0.0 changes the behvior about creating default environment. When
calling EnsureSConsVersion and EnsurePythonVersion, scons creates
default environment and use it as these two functions' execution scope.
However, in scons 4.0.0, it would *really* create the *default*
environment specifying under site_scons/site_tools. Furthermore, the
default environment also creates the git environment. However, the git
environment depends on m5 utility which path should be set after the
version checks in site_tools.py. It becomes a chicken egg problem.
To solve this, I move the version checks into Sconstruct which is the
entrypoint of the build system.
Change-Id: I09e3014c30a944e812342435bf947637b4403e47
---
M SConstruct
M site_scons/site_init.py
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/SConstruct b/SConstruct
index 5033344..a2c0e07 100755
--- a/SConstruct
+++ b/SConstruct
@@ -141,6 +141,50 @@
main = Environment()
+# Check for recent-enough Python and SCons versions.
+try:
+ EnsureSConsVersion(3, 0, 0)
+except SystemExit as e:
+ print("""
+For more details, see:
+ http://gem5.org/documentation/general_docs/building
+""")
+ raise
+
+
+# Check for the python version. Python 2 is no longer supported.
+try:
+ EnsurePythonVersion(3, 0)
+except SystemExit as e:
+ print("""\033[93m
+Python 3 is now required.
+
+The following are steps to compile gem5 in Python 3 environment,
+
+*Step 1*: ensure Python 3 is installed. On Ubuntu like systems, you can
try \
+this command:
+
+ sudo apt-get install python3 python3-six python-is-python3
python3-pydot
+
+To run Python 3 from a container, you can try the Docker files in \
+util/dockerfiles folder.
+
+*Step 2*: ensure that scons is run in the Python 3 environment. If scons \
+isn't run automatically with Python 3, you can force it by replacing
`scons` \
+by the following phrase,
+
+ /usr/bin/env python3 $(which scons)
+
+For example, the following command will let scons compile gem5/X86 in the \
+Python 3 environment,
+
+ /usr/bin/env python3 $(which scons) build/X86/gem5.opt
+
+(Optional) For convenience reasons, you can set up an alias for the
Python3 \
+scons phrase in your environment. \033[0m
+""")
+ raise
+
from gem5_scons.util import get_termcap
termcap = get_termcap()
diff --git a/site_scons/site_init.py b/site_scons/site_init.py
index 2f7cbf1..ee19b56 100644
--- a/site_scons/site_init.py
+++ b/site_scons/site_init.py
@@ -41,48 +41,4 @@
from __future__ import print_function
from gem5_python_paths import extra_python_paths
-# Check for recent-enough Python and SCons versions.
-try:
- EnsureSConsVersion(3, 0, 0)
-except SystemExit as e:
- print("""
-For more details, see:
- http://gem5.org/documentation/general_docs/building
-""")
- raise
-
-
-# Check for the python version. Python 2 is no longer supported.
-try:
- EnsurePythonVersion(3, 0)
-except SystemExit as e:
- print("""\033[93m
-Python 3 is now required.
-
-The following are steps to compile gem5 in Python 3 environment,
-
-*Step 1*: ensure Python 3 is installed. On Ubuntu like systems, you can
try \
-this command:
-
- sudo apt-get install python3 python3-six python-is-python3
python3-pydot
-
-To run Python 3 from a container, you can try the Docker files in \
-util/dockerfiles folder.
-
-*Step 2*: ensure that scons is run in the Python 3 environment. If scons \
-isn't run automatically with Python 3, you can force it by replacing
`scons` \
-by the following phrase,
-
- /usr/bin/env python3 $(which scons)
-
-For example, the following command will let scons compile gem5/X86 in the \
-Python 3 environment,
-
- /usr/bin/env python3 $(which scons) build/X86/gem5.opt
-
-(Optional) For convenience reasons, you can set up an alias for the
Python3 \
-scons phrase in your environment. \033[0m
-""")
- raise
-
sys.path[1:1] = extra_python_paths
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38575
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: I09e3014c30a944e812342435bf947637b4403e47
Gerrit-Change-Number: 38575
Gerrit-PatchSet: 1
Gerrit-Owner: Yu-hsin Wang <[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