mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-23 09:40:29 +01:00
amd/vulkan: Use str.removesuffix() from Python 3.9
Signed-off-by: Ernst Persson <ernstp@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36398>
This commit is contained in:
parent
2bdbc72d27
commit
fc8a734849
1 changed files with 1 additions and 12 deletions
|
|
@ -52,17 +52,6 @@ annotate_${c.name}(${c.decl_params()})
|
|||
% endfor
|
||||
""")
|
||||
|
||||
# str.removesuffix requires python 3.9+ so implement our own to not break build
|
||||
# on older versions
|
||||
def removesuffix(s, suffix):
|
||||
l = len(suffix)
|
||||
if l == 0:
|
||||
return s
|
||||
idx = s.find(suffix)
|
||||
if idx == len(s) - l:
|
||||
return s[:-l]
|
||||
return s
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
|
@ -79,7 +68,7 @@ def main():
|
|||
if not e.name.startswith('Cmd') or e.alias or e.return_type != "void":
|
||||
continue
|
||||
|
||||
stripped_name = removesuffix(removesuffix(removesuffix(e.name, 'EXT'), 'KHR'), '2')
|
||||
stripped_name = e.name.removesuffix('EXT').removesuffix('KHR').removesuffix('2')
|
||||
if stripped_name in commands_names or stripped_name in EXCLUDED_COMMANDS:
|
||||
continue
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue