Hoa Nguyen has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/36157 )
Change subject: scons: Raise an exception when scons is run a Python2
environment
......................................................................
scons: Raise an exception when scons is run a Python2 environment
As gem5 has started to use Python2 incompatible features, compiling
gem5 in a Python2 environment results in an error.
This commit addresses this issue by raising an Exception when scons
is run in a Python2 environment, and adding a few pointers on how to
install Python3 and on how to use scons in a Python3 environment. The
solution works in a system where both Python2 and Python3 are
installed.
JIRA: https://gem5.atlassian.net/browse/GEM5-797
Change-Id: I98d4a39f586f39d9253ab2517b77e86c5ed19466
Signed-off-by: Hoa Nguyen <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36157
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M site_scons/site_init.py
1 file changed, 29 insertions(+), 6 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, but someone else must approve; Looks
good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/site_scons/site_init.py b/site_scons/site_init.py
index 28a9d0c..2f7cbf1 100644
--- a/site_scons/site_init.py
+++ b/site_scons/site_init.py
@@ -51,14 +51,37 @@
""")
raise
-# pybind11 requires python 2.7
+
+# Check for the python version. Python 2 is no longer supported.
try:
- EnsurePythonVersion(2, 7)
+ EnsurePythonVersion(3, 0)
except SystemExit as e:
- print ("""
-You can use a non-default installation of the Python interpreter by
-rearranging your PATH so that scons finds the non-default 'python' and
-'python-config' first.
+ 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
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36157
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: I98d4a39f586f39d9253ab2517b77e86c5ed19466
Gerrit-Change-Number: 36157
Gerrit-PatchSet: 6
Gerrit-Owner: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[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