From 0e7940bf2ede0147ee1eafced53bc9ad08a4015e Mon Sep 17 00:00:00 2001 From: Edwin Mons Date: Fri, 17 Oct 2014 12:06:17 +0200 Subject: Make core.c generation compatible with Python 2.4 generate_embedded_lua in Sluift/SConscript used a bytearray, which wasn't available until Python 2.6. Modified the code to use the string data instead of a bytearray. Test-information: Builds on OS X 10.9 and CentOS 5.9 sluift binary works on both platforms Change-Id: Iae29f76e32c8b7a827bc438caf09457b259446ca diff --git a/Sluift/SConscript b/Sluift/SConscript index 5e0a030..a2b6748 100644 --- a/Sluift/SConscript +++ b/Sluift/SConscript @@ -72,11 +72,10 @@ elif env["SCONS_STAGE"] == "build" : f = open(source[0].abspath, "r") data = f.read() f.close() - data_bytes = bytearray(data) f = open(target[0].abspath, "w") f.write('#include \n') - f.write('const size_t ' + source[0].name.replace(".", "_") + "_size = " + str(len(data_bytes)) + ";\n") - f.write('const char ' + source[0].name.replace(".", "_") + "[] = {" + ", ".join([str(b) for b in data_bytes]) + "};\n") + f.write('const size_t ' + source[0].name.replace(".", "_") + "_size = " + str(len(data)) + ";\n") + f.write('const char ' + source[0].name.replace(".", "_") + "[] = {" + ", ".join([str(ord(c)) for c in data]) + "};\n") f.close() sluift_env.Command("core.c", ["core.lua"], env.Action(generate_embedded_lua, cmdstr="$GENCOMSTR")) -- cgit v0.10.2-6-g49f6