File python36-buildfix1-s390x.patch of Package A_sr-Mesa
68
1
Index: mesa-24.1.7/src/nouveau/headers/class_parser.py
2
===================================================================
3
--- mesa-24.1.7.orig/src/nouveau/headers/class_parser.py
4
+++ mesa-24.1.7/src/nouveau/headers/class_parser.py
5
6
7
from mako.template import Template
8
9
+def removeprefix(s, prefix):
10
+ if s.startswith(prefix):
11
+ return s[len(prefix):]
12
+ return s
13
+
14
+def removesuffix(s, suffix):
15
+ if s.endswith(suffix):
16
+ return s[:-len(suffix)]
17
+ return s
18
+
19
METHOD_ARRAY_SIZES = {
20
'BIND_GROUP_CONSTANT_BUFFER' : 16,
21
'CALL_MME_DATA' : 256,
22
23
if ":" in list[2]:
24
state = 1
25
elif teststr in list[1]:
26
- curmthd.field_defs[curfield][list[1].removeprefix(teststr)] = list[2]
27
+ curmthd.field_defs[curfield][removeprefix(list[1], teststr)] = list[2]
28
else:
29
state = 1
30
31
32
if ("0x" in list[2]):
33
state = 1
34
else:
35
- field = list[1].removeprefix(teststr)
36
+ field = removeprefix(list[1], teststr)
37
bitfield = list[2].split(":")
38
curmthd.field_name_start[field] = bitfield[1]
39
curmthd.field_name_end[field] = bitfield[0]
40
41
is_array = 0
42
if (':' in list[2]):
43
continue
44
- name = list[1].removeprefix(teststr)
45
+ name = removeprefix(list[1], teststr)
46
if name.endswith("(i)"):
47
is_array = 1
48
- name = name.removesuffix("(i)")
49
+ name = removesuffix(name, "(i)")
50
if name.endswith("(j)"):
51
is_array = 1
52
- name = name.removesuffix("(j)")
53
+ name = removesuffix(name, "(j)")
54
x = method()
55
x.name = name
56
x.addr = list[2]
57
58
59
clheader = os.path.basename(args.in_h)
60
nvcl = clheader
61
- nvcl = nvcl.removeprefix("cl")
62
- nvcl = nvcl.removesuffix(".h")
63
+ nvcl = removeprefix(nvcl, "cl")
64
+ nvcl = removesuffix(nvcl, ".h")
65
nvcl = nvcl.upper()
66
nvcl = "NV" + nvcl
67
68