summaryrefslogtreecommitdiff
path: root/games-util/xboxdrv/files/xboxdrv-0.8.8-Update-SConstruct-to-python3.patch
blob: accb4317fad418e5820741133a08b91ed8cca4d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 39a334fbc0482626455f417e97308e52aa8746a7 Mon Sep 17 00:00:00 2001
From: Ingo Ruhnke <grumbel@gmail.com>
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