scons: add py3 support

SCons 3.1 has moved to python 3, requiring this fix
to continue supporting scons builds.

Closes: #944
Cc: mesa-stable@lists.freedesktop.org
Acked-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Eric Engestrom <eric@engestrom.ch>
This commit is contained in:
Michel Zou
2019-09-28 08:53:38 +02:00
committed by Eric Engestrom
parent 411e50a8fd
commit 3f92d17894
3 changed files with 9 additions and 5 deletions

View File

@@ -128,9 +128,9 @@ def generate(env):
if not path: if not path:
path = [] path = []
if SCons.Util.is_String(path): if SCons.Util.is_String(path):
path = string.split(path, os.pathsep) path = str.split(path, os.pathsep)
env['ENV']['PATH'] = string.join([dir] + path, os.pathsep) env['ENV']['PATH'] = str.join(os.pathsep, [dir] + path)
# Most of mingw is the same as gcc and friends... # Most of mingw is the same as gcc and friends...
gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas'] gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas']

View File

@@ -262,8 +262,12 @@ def parse_source_list(env, filename, names=None):
sym_table = parser.parse(src.abspath) sym_table = parser.parse(src.abspath)
if names: if names:
if isinstance(names, basestring): if sys.version_info[0] >= 3:
names = [names] if isinstance(names, str):
names = [names]
else:
if isinstance(names, basestring):
names = [names]
symbols = names symbols = names
else: else:

View File

@@ -132,7 +132,7 @@ def check_cc(env, cc, expr, cpp_opt = '-E'):
sys.stdout.write('Checking for %s ... ' % cc) sys.stdout.write('Checking for %s ... ' % cc)
source = tempfile.NamedTemporaryFile(suffix='.c', delete=False) source = tempfile.NamedTemporaryFile(suffix='.c', delete=False)
source.write('#if !(%s)\n#error\n#endif\n' % expr) source.write(('#if !(%s)\n#error\n#endif\n' % expr).encode())
source.close() source.close()
# sys.stderr.write('%r %s %s\n' % (env['CC'], cpp_opt, source.name)); # sys.stderr.write('%r %s %s\n' % (env['CC'], cpp_opt, source.name));