summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Zou <xantares09@hotmail.com>2019-09-28 08:53:38 +0200
committerJuan A. Suarez Romero <jasuarez@igalia.com>2019-10-02 09:41:27 -0400
commit09ba783aea6599e44c8a25658869b4d93f377b32 (patch)
treeea0269d66bfb2d2f88c7bb1904a9963fea475ff1
parent70ef5d63f70f07da615065f17e74c85f17dbb69e (diff)
downloadmesa-09ba783aea6599e44c8a25658869b4d93f377b32.tar.gz
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> (cherry picked from commit 3f92d17894bedf2da6aabe017004391b91a5e860)
-rw-r--r--scons/crossmingw.py4
-rw-r--r--scons/custom.py8
-rwxr-xr-xscons/gallium.py2
3 files changed, 9 insertions, 5 deletions
diff --git a/scons/crossmingw.py b/scons/crossmingw.py
index 609cd00418e..b2efccea7e8 100644
--- a/scons/crossmingw.py
+++ b/scons/crossmingw.py
@@ -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']
diff --git a/scons/custom.py b/scons/custom.py
index 8028990ef61..2fad8f5b6d4 100644
--- a/scons/custom.py
+++ b/scons/custom.py
@@ -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:
diff --git a/scons/gallium.py b/scons/gallium.py
index 7dae036e5ad..723645334d3 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -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));