Fix version math

This commit is contained in:
iranl
2024-12-05 22:08:49 +01:00
parent c4f9644c97
commit 3b3eb2902c
3 changed files with 4 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ parser.add_argument('ota_type', type=str)
args = parser.parse_args()
regex = r"\#define NUKI_HUB_VERSION \"(.*)\""
regex2 = r"\#define NUKI_HUB_VERSION_INT \(uint32_t\)\"(.*)\""
regex2 = r"\#define NUKI_HUB_VERSION_INT \(uint32_t\)(.*)"
version = "unknown"
with open('src/Config.h', 'r') as file:
@@ -37,7 +37,7 @@ 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(regex2, "#define NUKI_HUB_VERSION_INT (uint32_t)\"" + str(version_int) + "\"", content_new, flags = re.M)
content_new = re.sub(regex2, "#define NUKI_HUB_VERSION_INT (uint32_t)" + str(version_int), content_new, flags = re.M)
with open('src/Config.h', 'w') as writefile:
writefile.write(content_new)