makepanda: Make version parsing in CreatePandaVersionFiles more robust

This commit is contained in:
rdb 2023-10-09 16:50:59 +02:00
parent 27daecf030
commit dcc96a60b1

View File

@ -3038,11 +3038,18 @@ END
#endif"""
def CreatePandaVersionFiles():
version1=int(VERSION.split(".")[0])
version2=int(VERSION.split(".")[1])
version3=int(VERSION.split(".")[2])
nversion=version1*1000000+version2*1000+version3
if (DISTRIBUTOR != "cmu"):
parts = VERSION.split(".", 2)
version1 = int(parts[0])
version2 = int(parts[1])
version3 = 0
if len(parts) > 2:
for c in parts[2]:
if c.isdigit():
version3 = version3 * 10 + ord(c) - 48
else:
break
nversion = version1 * 1000000 + version2 * 1000 + version3
if DISTRIBUTOR != "cmu":
# Subtract 1 if we are not an official version.
nversion -= 1