Fix version math
This commit is contained in:
@@ -29,12 +29,14 @@ elif (data[args.ota_type]['version'] == version):
|
||||
number = data[args.ota_type]['number'] + 1
|
||||
else:
|
||||
number = 1
|
||||
|
||||
|
||||
version_int = version*100
|
||||
content_new = ""
|
||||
|
||||
with open ('src/Config.h', 'r' ) as readfile:
|
||||
file_content = readfile.read()
|
||||
content_new = re.sub(regex, "#define NUKI_HUB_VERSION \"" + str(version) + "-" + args.ota_type + str(number) + "\"", file_content, flags = re.M)
|
||||
content_new = re.sub(regex, "#define NUKI_HUB_VERSION_INT \"" + str(version_int) + "-" + args.ota_type + str(number) + "\"", content_new, flags = re.M)
|
||||
|
||||
with open('src/Config.h', 'w') as writefile:
|
||||
writefile.write(content_new)
|
||||
@@ -24,6 +24,7 @@ with open('ota/manifest.json', 'r+') as json_file:
|
||||
if (args.build == 'none'):
|
||||
data[args.ota_type]['time'] = "0000-00-00"
|
||||
data[args.ota_type]['version'] = "No beta available"
|
||||
data[args.ota_type]['version_int'] = "No beta available"
|
||||
data[args.ota_type]['fullversion'] = "No beta available"
|
||||
data[args.ota_type]['build'] = ""
|
||||
data[args.ota_type]['number'] = "0"
|
||||
@@ -37,12 +38,13 @@ with open('ota/manifest.json', 'r+') as json_file:
|
||||
|
||||
data[args.ota_type]['time'] = datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
||||
data[args.ota_type]['version'] = str(version)
|
||||
|
||||
data[args.ota_type]['version_int'] = str(version*100)
|
||||
|
||||
if (args.ota_type == "release"):
|
||||
data[args.ota_type]['fullversion'] = str(version)
|
||||
else:
|
||||
data[args.ota_type]['fullversion'] = str(version) + "-" + args.ota_type + str(data[args.ota_type]['number'])
|
||||
|
||||
|
||||
data[args.ota_type]['build'] = args.build
|
||||
json_file.seek(0)
|
||||
json.dump(data, json_file, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user