diff --git a/SConstruct b/SConstruct index 932eb819d3..b93a000266 100755 --- a/SConstruct +++ b/SConstruct @@ -1013,7 +1013,7 @@ export_vars += ['USE_FENV', 'TARGET_ISA', 'TARGET_GPU_ISA', 'CP_ANNOTATE', # operands are the name of the variable and a Value node containing the # value of the variable. def build_config_file(target, source, env): - (variable, value) = [s.get_contents() for s in source] + (variable, value) = [s.get_contents().decode('utf-8') for s in source] with open(str(target[0]), 'w') as f: print('#define', variable, value, file=f) return None diff --git a/src/SConscript b/src/SConscript index e8b90acf56..552235a66b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -621,7 +621,7 @@ for opt in export_vars: env.ConfigFile(opt) def makeTheISA(source, target, env): - isas = [ src.get_contents() for src in source ] + isas = [ src.get_contents().decode('utf-8') for src in source ] target_isa = env['TARGET_ISA'] def define(isa): return isa.upper() + '_ISA' @@ -823,7 +823,7 @@ depends.sort(key = lambda x: x.name) # Generate Python file containing a dict specifying the current # buildEnv flags. def makeDefinesPyFile(target, source, env): - build_env = source[0].get_contents() + build_env = source[0].get_contents().decode('utf-8') code = code_formatter() code(""" @@ -882,7 +882,7 @@ def createSimObjectCxxConfig(is_header): def body(target, source, env): assert len(target) == 1 and len(source) == 1 - name = str(source[0].get_contents()) + name = source[0].get_contents().decode('utf-8') obj = sim_objects[name] code = code_formatter() diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py index 2fdd5a19b3..fd1ea91258 100644 --- a/src/python/m5/util/__init__.py +++ b/src/python/m5/util/__init__.py @@ -43,6 +43,8 @@ import os import re import sys +from six import string_types + from . import convert from . import jobfile @@ -122,7 +124,7 @@ def compareVersions(v1, v2): def make_version_list(v): if isinstance(v, (list,tuple)): return v - elif isinstance(v, str): + elif isinstance(v, string_types): return map(lambda x: int(re.match('\d+', x).group()), v.split('.')) else: raise TypeError() @@ -196,7 +198,7 @@ def readCommand(cmd, **kwargs): return exception raise - return subp.communicate()[0] + return subp.communicate()[0].decode('utf-8') def makeDir(path): """Make a directory if it doesn't exist. If the path does exist,