scons: add py3 support
authorMichel Zou <xantares09@hotmail.com>
Sat, 28 Sep 2019 06:53:38 +0000 (08:53 +0200)
committerEric Engestrom <eric@engestrom.ch>
Sat, 28 Sep 2019 16:53:08 +0000 (16:53 +0000)
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>
scons/crossmingw.py
scons/custom.py
scons/gallium.py

index 609cd00418e4ce9e8f1d3f4d71366822af5adda6..b2efccea7e81e8a28722eea94c4e76844c406aa2 100644 (file)
@@ -128,9 +128,9 @@ def generate(env):
         if not path: 
             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...
     gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas']
index 8028990ef61b3a1af8f5de0f8697b13375d89d6b..2fad8f5b6d4398dfb0fe18c771579b8194f71192 100644 (file)
@@ -262,8 +262,12 @@ def parse_source_list(env, filename, names=None):
     sym_table = parser.parse(src.abspath)
 
     if names:
-        if isinstance(names, basestring):
-            names = [names]
+        if sys.version_info[0] >= 3:
+            if isinstance(names, str):
+                names = [names]
+        else:
+            if isinstance(names, basestring):
+                names = [names]
 
         symbols = names
     else:
index 72d8604169e13eef20028b13c3f1f03d0f5f2c22..9381f804a31d39c70e4f45f976a6f20f4054e056 100755 (executable)
@@ -132,7 +132,7 @@ def check_cc(env, cc, expr, cpp_opt = '-E'):
     sys.stdout.write('Checking for %s ... ' % cc)
 
     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()
 
     # sys.stderr.write('%r %s %s\n' % (env['CC'], cpp_opt, source.name));