scons: file removed from python3

Change-Id: I95794fec5cc9c6e72c9ae53f586052be71436c87
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26249
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Giacomo Travaglini
2020-03-02 15:08:41 +00:00
parent 10b4842407
commit bb95aa14c6
3 changed files with 11 additions and 10 deletions

View File

@@ -284,7 +284,8 @@ def Blob(blob_path, symbol):
cpp_path = path_noext + '.cc'
hpp_path = path_noext + '.hh'
def embedBlob(target, source, env):
data = file(str(source[0]), 'r').read()
with open(str(source[0]), 'rb') as f:
data = f.read()
cpp_code = code_formatter()
hpp_code = code_formatter()
blobToCpp(data, symbol, cpp_code, hpp_code, namespace='Blobs')
@@ -767,7 +768,8 @@ class DictImporter(object):
mod.__path__ = source.modpath
mod.__file__ = source.abspath
exec file(source.abspath, 'r') in mod.__dict__
compiled = compile(open(source.abspath).read(), source.abspath, 'exec')
exec(compiled, mod.__dict__)
return mod
@@ -850,7 +852,8 @@ PySource('m5', 'python/m5/defines.py')
def makeInfoPyFile(target, source, env):
code = code_formatter()
for src in source:
data = ''.join(file(src.srcnode().abspath, 'r').xreadlines())
with open(src.srcnode().abspath, 'r') as f:
data = ''.join(f)
code('$src = ${{repr(data)}}')
code.write(str(target[0]))