summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-12-02 17:52:44 -0800
committerGabe Black <gabeblack@google.com>2019-12-07 00:03:14 +0000
commita39c8db854c8e2a2c9101f556e67cad883ece433 (patch)
treea53e0cb3a80068d9f4e8ac1f194ed87e5bc0d9e6
parent451ff4aa048628effe3f3ba6e2c42080bb4612fa (diff)
downloadgem5-a39c8db854c8e2a2c9101f556e67cad883ece433.tar.xz
scons: Fixes to improve python 3 support.
Some simple fixes to improve python 3 compatability in scons. Change-Id: I89aba6ed9d73ee733307c57e033c636029d9cb7a Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23264 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
-rwxr-xr-xSConstruct7
-rw-r--r--site_scons/site_init.py4
-rw-r--r--site_scons/site_tools/default.py2
-rw-r--r--site_scons/site_tools/git.py2
4 files changed, 8 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct
index 9a382102c..5a90808b1 100755
--- a/SConstruct
+++ b/SConstruct
@@ -206,7 +206,7 @@ def rfind(l, elt, offs = -1):
for i in range(len(l)+offs, 0, -1):
if l[i] == elt:
return i
- raise ValueError, "element not found"
+ raise ValueError("element not found")
# Take a list of paths (or SCons Nodes) and return a list with all
# paths made absolute and ~-expanded. Paths will be interpreted
@@ -717,7 +717,8 @@ if main['USE_PYTHON']:
# verify that this stuff works
if not conf.CheckHeader('Python.h', '<>'):
- error("Check failed for Python.h header in", py_includes, "\n"
+ error("Check failed for Python.h header in",
+ ' '.join(py_includes), "\n"
"Two possible reasons:\n"
"1. Python headers are not installed (You can install the "
"package python-dev on Ubuntu and RedHat)\n"
@@ -941,7 +942,7 @@ class CpuModel(object):
# Add self to dict
if name in CpuModel.dict:
- raise AttributeError, "CpuModel '%s' already registered" % name
+ raise AttributeError("CpuModel '%s' already registered" % name)
CpuModel.dict[name] = self
Export('CpuModel')
diff --git a/site_scons/site_init.py b/site_scons/site_init.py
index 351f49bc0..623e26e0a 100644
--- a/site_scons/site_init.py
+++ b/site_scons/site_init.py
@@ -49,7 +49,7 @@ try:
# 0.98, and the second will fail for 0.98.0
EnsureSConsVersion(0, 98)
EnsureSConsVersion(0, 98, 1)
-except SystemExit, e:
+except SystemExit as e:
print("""
For more details, see:
http://gem5.org/Dependencies
@@ -59,7 +59,7 @@ For more details, see:
# pybind11 requires python 2.7
try:
EnsurePythonVersion(2, 7)
-except SystemExit, e:
+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
diff --git a/site_scons/site_tools/default.py b/site_scons/site_tools/default.py
index 9d02ab73b..08736f01a 100644
--- a/site_scons/site_tools/default.py
+++ b/site_scons/site_tools/default.py
@@ -61,7 +61,7 @@ def common_config(env):
"M5", # M5 configuration (e.g., path to kernels)
]
- for key,val in sorted(os.environ.iteritems()):
+ for key,val in sorted(os.environ.items()):
if key in use_vars or \
any([key.startswith(prefix) for prefix in use_prefixes]):
env['ENV'][key] = val
diff --git a/site_scons/site_tools/git.py b/site_scons/site_tools/git.py
index 1b40f28ef..e5b79129b 100644
--- a/site_scons/site_tools/git.py
+++ b/site_scons/site_tools/git.py
@@ -54,7 +54,7 @@ def install_style_hooks(env):
try:
gitdir = env.Dir(readCommand(
["git", "rev-parse", "--git-dir"]).strip("\n"))
- except Exception, e:
+ except Exception as e:
print("Warning: Failed to find git repo directory: %s" % e)
return