Skip to content

Commit 44dbd3c

Browse files
committed
Fixes version strings
1 parent eb3ed67 commit 44dbd3c

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

builder/__init__.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,23 @@ def setup_windows_build():
148148
return _windows_env
149149

150150

151+
def get_lvgl_version():
152+
with open('lib/lvgl/lv_version.h', 'r') as f:
153+
data = f.read()
154+
155+
data = data.split('LVGL_VERSION_MAJOR', 1)[-1]
156+
major, data = [item.strip() for item in data.split('\n', 1)]
157+
data = data.split('LVGL_VERSION_MINOR', 1)[-1]
158+
minor, data = [item.strip() for item in data.split('\n', 1)]
159+
data = data.split('LVGL_VERSION_PATCH', 1)[-1]
160+
patch, data = [item.strip() for item in data.split('\n', 1)]
161+
162+
if not patch:
163+
patch = '0'
164+
165+
return f'{major}.{minor}.{patch}'
166+
167+
151168
def set_mp_version(port):
152169
mpconfigport = f'lib/micropython/ports/{port}/mpconfigport.h'
153170

@@ -156,9 +173,10 @@ def set_mp_version(port):
156173

157174
if 'MICROPY_BANNER_NAME_AND_VERSION' not in data:
158175
data += (
159-
'\n\n#include "genhdr/mpversion.h"'
160-
'\n\n#define MICROPY_BANNER_NAME_AND_VERSION "LVGL MicroPython '
161-
'1.23.0 on " MICROPY_BUILD_DATE\n\n'
176+
'\n\n#include "genhdr/mpversion.h"\n\n'
177+
'\n\n#define MICROPY_BANNER_NAME_AND_VERSION '
178+
f'"LVGL ({get_lvgl_version()}) MicroPython (" MICROPY_VERSION_STRING '
179+
f'") Binding compiled on " MICROPY_BUILD_DATE\n\n'
162180
)
163181

164182
with open(mpconfigport, 'wb') as f:

builder/esp32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ def update_panic_handler():
978978
beg, end = data.split('"MPY version : "', 1)
979979
end = end.split('"\\r\\n"', 1)[1]
980980
data = (
981-
f'{beg}"LVGL MPY version : 1.23.0 on " '
981+
f'{beg}"LVGL MPY version : " MICROPY_VERSION_STRING " on " '
982982
f'MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN "\\r\\n"{end}'
983983
)
984984

0 commit comments

Comments
 (0)