summaryrefslogtreecommitdiff
path: root/user/mesa/python3-compat.patch
blob: 8532f8c0c0ec631d6c5ca276e20890fb3d3fe976 (plain) (blame)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
--- mesa-17.3.1/src/gallium/drivers/r600/egd_tables.py	(original)
+++ mesa-17.3.1/src/gallium/drivers/r600/egd_tables.py	(refactored)
@@ -60,7 +60,7 @@
         """
         fragments = [
             '"%s\\0" /* %s */' % (
-                te[0].encode('string_escape'),
+                te[0].encode('unicode-escape'),
                 ', '.join(str(idx) for idx in te[2])
             )
             for te in self.table
@@ -217,10 +217,10 @@
     strings = StringTable()
     strings_offsets = IntTable("int")
 
-    print '/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */'
-    print
-    print CopyRight.strip()
-    print '''
+    print('/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */')
+    print()
+    print(CopyRight.strip())
+    print('''
 #ifndef EG_TABLES_H
 #define EG_TABLES_H
 
@@ -242,20 +242,20 @@
         unsigned name_offset;
         unsigned op;
 };
-'''
-
-    print 'static const struct eg_packet3 packet3_table[] = {'
+''')
+
+    print('static const struct eg_packet3 packet3_table[] = {')
     for pkt in packets:
-        print '\t{%s, %s},' % (strings.add(pkt[5:]), pkt)
-    print '};'
-    print
-
-    print 'static const struct eg_field egd_fields_table[] = {'
+        print('\t{%s, %s},' % (strings.add(pkt[5:]), pkt))
+    print('};')
+    print()
+
+    print('static const struct eg_field egd_fields_table[] = {')
 
     fields_idx = 0
     for reg in regs:
         if len(reg.fields) and reg.own_fields:
-            print '\t/* %s */' % (fields_idx)
+            print('\t/* %s */' % (fields_idx))
 
             reg.fields_idx = fields_idx
 
@@ -266,34 +266,34 @@
                         while value[1] >= len(values_offsets):
                             values_offsets.append(-1)
                         values_offsets[value[1]] = strings.add(strip_prefix(value[0]))
-                    print '\t{%s, %s(~0u), %s, %s},' % (
+                    print('\t{%s, %s(~0u), %s, %s},' % (
                         strings.add(field.name), field.s_name,
-                        len(values_offsets), strings_offsets.add(values_offsets))
+                        len(values_offsets), strings_offsets.add(values_offsets)))
                 else:
-                    print '\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name)
+                    print('\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name))
                 fields_idx += 1
 
-    print '};'
-    print
-
-    print 'static const struct eg_reg egd_reg_table[] = {'
+    print('};')
+    print()
+
+    print('static const struct eg_reg egd_reg_table[] = {')
     for reg in regs:
         if len(reg.fields):
-            print '\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
-                len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx)
+            print('\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
+                len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx))
         else:
-            print '\t{%s, %s},' % (strings.add(reg.name), reg.r_name)
-    print '};'
-    print
+            print('\t{%s, %s},' % (strings.add(reg.name), reg.r_name))
+    print('};')
+    print()
 
     strings.emit(sys.stdout, "egd_strings")
 
-    print
+    print()
 
     strings_offsets.emit(sys.stdout, "egd_strings_offsets")
 
-    print
-    print '#endif'
+    print()
+    print('#endif')
 
 
 def main():