Apparently people out there want to build kitty with rc Go versions

Fixes #6499
This commit is contained in:
Kovid Goyal
2023-07-26 02:14:50 +05:30
parent 93ae6e962f
commit 22dd8ecb62

View File

@@ -956,7 +956,11 @@ def update_go_generated_files(args: Options, kitty_exe: str) -> None:
def parse_go_version(x: str) -> Tuple[int, int, int]:
ans = list(map(int, x.split('.')))
def safe_int(x: str) -> int:
with suppress(ValueError):
return int(x)
return int(re.split(r'[a-zA-Z]', x)[0])
ans = list(map(safe_int, x.split('.')))
while len(ans) < 3:
ans.append(0)
return ans[0], ans[1], ans[2]