Index: mesa-25.2.0/src/nouveau/headers/class_parser.py =================================================================== --- mesa-25.2.0.orig/src/nouveau/headers/class_parser.py +++ mesa-25.2.0/src/nouveau/headers/class_parser.py @@ -14,6 +14,16 @@ from mako.template import Template import util +def removeprefix(s, prefix): + if s.startswith(prefix): + return s[len(prefix):] + return s + +def removesuffix(s, suffix): + if s.endswith(suffix): + return s[:-len(suffix)] + return s + METHOD_ARRAY_SIZES = { 'BIND_GROUP_CONSTANT_BUFFER' : 16, 'CALL_MME_DATA' : 256, @@ -478,7 +488,7 @@ def parse_header(nvcl, f): state = 1 elif teststr in list[1]: if not SKIP_FIELD[0] in list[1]: - curfield.defs[list[1].removeprefix(teststr)] = list[2] + curfield.defs[removeprefix(list[1],teststr)] = list[2] else: state = 1 @@ -488,7 +498,7 @@ def parse_header(nvcl, f): if ("0x" in list[2]): state = 1 else: - field = list[1].removeprefix(teststr) + field = removeprefix(list[1], teststr) bitfield = list[2].split(":") f = Field(field, bitfield[1], bitfield[0]) curmthd.fields.append(f) @@ -508,13 +518,13 @@ def parse_header(nvcl, f): is_array = 0 if (':' in list[2]): continue - name = list[1].removeprefix(teststr) + name = removeprefix(list[1], teststr) if name.endswith("(i)"): is_array = 1 - name = name.removesuffix("(i)") + name = removesuffix(name, "(i)") if name.endswith("(j)"): is_array = 1 - name = name.removesuffix("(j)") + name = removesuffix(name, "(j)") curmthd = Method(name, list[2], is_array) methods[name] = curmthd @@ -523,8 +533,8 @@ def parse_header(nvcl, f): return (version, methods) def nvcl_for_filename(name): - name = name.removeprefix("cl") - name = name.removesuffix(".h") + name = removeprefix(name, "cl") + name = removesuffix(name, ".h") return "NV" + name.upper() def main(): @@ -553,7 +563,7 @@ def main(): if args.prev_in_h is not None: prev_clheader = os.path.basename(args.prev_in_h) prev_nvcl = nvcl_for_filename(prev_clheader) - prev_mod = prev_clheader.removesuffix(".h") + prev_mod = removesuffix(prev_clheader, ".h") with open(args.prev_in_h, 'r', encoding='utf-8') as f: (prev_version, prev_methods) = parse_header(prev_nvcl, f) --- mesa-25.2.0/src/compiler/nir/nir_algebraic.py.orig 2025-08-08 14:53:23.002148943 +0200 +++ mesa-25.2.0/src/compiler/nir/nir_algebraic.py 2025-08-08 14:57:34.748734069 +0200 @@ -31,6 +31,11 @@ from nir_opcodes import opcodes, type_sizes +def removeprefix(s, prefix): + if s.startswith(prefix): + return s[len(prefix):] + return s + # This should be the same as NIR_SEARCH_MAX_COMM_OPS in nir_search.c nir_search_max_comm_ops = 8 @@ -395,7 +400,7 @@ self.nnan = cond.pop('nnan', False) self.ninf = cond.pop('ninf', False) self.contract = cond.pop('contract', False) - self.swizzle = -1 if m.group('swizzle') is None else swizzles[m.group('swizzle').removeprefix('.')] + self.swizzle = -1 if m.group('swizzle') is None else swizzles[removeprefix(m.group('swizzle'),'.')] assert len(cond) <= 1 self.cond = cond.popitem()[0] if cond else None