From 39a334fbc0482626455f417e97308e52aa8746a7 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sun, 24 Nov 2019 18:16:16 +0100 Subject: [PATCH 1/3] Update SConstruct to python3 --- SConstruct | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git SConstruct SConstruct index 4cd7970..54fa11f 100644 --- a/SConstruct +++ b/SConstruct @@ -15,7 +15,7 @@ def build_dbus_glue(target, source, env): "--mode=glib-server", "--prefix=" + env['DBUS_PREFIX'], source[0].get_path()], stdout=subprocess.PIPE).communicate()[0] - + xml = xml.decode() xml = re.sub(r"callback = \(([A-Za-z_]+)\) \(marshal_data \? marshal_data : cc->callback\);", r"union { \1 fn; void* obj; } conv;\n " "conv.obj = (marshal_data ? marshal_data : cc->callback);\n " @@ -29,14 +29,14 @@ def build_bin2h(target, source, env): Takes a list of files and converts them into a C source that can be included """ def c_escape(str): - return str.translate(string.maketrans("/.-", "___")) + return str.translate(str.maketrans("/.-", "___")) - print target - print source + print(target) + print(source) with open(target[0].get_path(), "w") as fout: fout.write("// autogenerated by scons Bin2H builder, do not edit by hand!\n\n") - if env.has_key("BIN2H_NAMESPACE"): + if "BIN2H_NAMESPACE" in env: fout.write("namespace %s {\n\n" % env["BIN2H_NAMESPACE"]) # write down data @@ -45,8 +45,8 @@ def build_bin2h(target, source, env): data = fin.read() fout.write("// \"%s\"\n" % src.get_path()) fout.write("const char %s[] = {" % c_escape(src.get_path())) - bytes_arr = ["0x%02x" % ord(c) for c in data] - for i in xrange(len(bytes_arr)): + bytes_arr = ["0x%02x" % c for c in data] + for i in range(len(bytes_arr)): if i % 13 == 0: fout.write("\n ") fout.write(bytes_arr[i]) @@ -62,7 +62,7 @@ def build_bin2h(target, source, env): for src in source], ",\n")) fout.write("\n}\n\n") - if env.has_key("BIN2H_NAMESPACE"): + if "BIN2H_NAMESPACE" in env: fout.write("} // namespace %s\n\n" % env["BIN2H_NAMESPACE"]) fout.write("/* EOF */\n") @@ -131,12 +131,12 @@ env.Append(CPPDEFINES = { 'PACKAGE_VERSION': "'\"%s\"'" % package_version }) conf = Configure(env) if not conf.env['CXX']: - print "g++ must be installed!" + print("g++ must be installed!") Exit(1) # X11 checks if not conf.CheckLibWithHeader('X11', 'X11/Xlib.h', 'C++'): - print 'libx11-dev must be installed!' + print('libx11-dev must be installed!') Exit(1) env = conf.Finish() -- 2.29.0.rc1