Make build scripts Python3 compatible

- The Windows, UWP, Android (on Windows) and Linux builds are
  tested with Scons 3.0 alpha using Python 3.
- OSX and iOS should hopefully work but are not tested since
  I don't have a Mac.
- Builds using SCons 2.5 and Python 2 should not be impacted.
This commit is contained in:
Matthias Hoelzl 2017-08-26 18:53:49 +02:00
parent a919a013f5
commit b6e1e47e3a
17 changed files with 123 additions and 87 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python
Import('env')
from compat import byte_to_str
def make_splash(target, source, env):
@ -8,17 +9,17 @@ def make_splash(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
f = open(src, "rb")
g = open(dst, "wb")
g = open(dst, "w")
buf = f.read()
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef BOOT_SPLASH_H\n")
g.write("#define BOOT_SPLASH_H\n")
g.write("static const Color boot_splash_bg_color = Color(1,1,1,1);\n");
g.write("static const Color boot_splash_bg_color = Color(1,1,1,1);\n")
g.write("static const unsigned char boot_splash_png[] = {\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write(byte_to_str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
@ -28,7 +29,7 @@ def make_app_icon(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
f = open(src, "rb")
g = open(dst, "wb")
g = open(dst, "w")
buf = f.read()
@ -37,7 +38,7 @@ def make_app_icon(target, source, env):
g.write("#define APP_ICON_H\n")
g.write("static const unsigned char app_icon_png[] = {\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write(byte_to_str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")