Skip to content

Commit eb818d9

Browse files
committed
Merge branch 'main' of https://github.com/lvgl-micropython/lvgl_micropython into swrotate-for-all-busses
2 parents f79b485 + 5fad2fc commit eb818d9

File tree

2 files changed

+52
-35
lines changed

2 files changed

+52
-35
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: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ def submodules():
857857

858858
cmds = [
859859
[f'export "IDF_PATH={os.path.abspath(idf_path)}"'],
860-
['cd', idf_path],
860+
['cd', os.path.abspath(idf_path)],
861861
['./install.sh', 'all']
862862
]
863863

@@ -870,36 +870,38 @@ def submodules():
870870
if result != 0:
871871
sys.exit(result)
872872

873-
env, cmds = setup_idf_environ()
873+
cmds = []
874874

875-
wifi_lib = os.path.abspath(
876-
os.path.join(idf_path, 'components/esp_wifi/lib')
877-
)
878-
berkeley_db = os.path.abspath('lib/micropython/lib/berkeley-db-1.xx/README')
879-
880-
if not os.path.exists(berkeley_db) or not os.path.exists(wifi_lib):
881-
cmds.append(['cd lib/micropython'])
882-
for dep in (
883-
'tinyusb',
884-
'micropython-lib',
885-
'protobuf-c',
886-
'wiznet5k',
887-
'lwip',
888-
'mbedtls',
889-
'axtls',
890-
'berkeley-db-1.xx',
891-
'btstack'
892-
):
893-
path = f"lib/{dep}"
875+
for name, file in (
876+
('berkeley-db-1.xx', 'README'),
877+
('mbedtls', 'README.md'),
878+
('micropython-lib', 'README.md'),
879+
('tinyusb', 'README.rst')
880+
):
881+
file = os.path.join('lib/micropython/lib', name, file)
882+
if not os.path.exists(file):
883+
cmds.extend([
884+
[f'git submodule sync lib/{name}'],
885+
[f'git submodule update --init --depth=1 lib/{name}']
886+
])
887+
if cmds:
888+
cmds.insert(0, ['cd lib/micropython'])
889+
cmds.append(['cd ../..'])
890+
891+
cmds.insert(0, [f'cd {SCRIPT_DIR}'])
892+
cmds.insert(0, ['. ./export.sh'])
893+
cmds.insert(0, ['cd', os.path.abspath(idf_path)])
894+
895+
if 'GITHUB_RUN_ID' in os.environ:
896+
cmds.insert(0, [f'export "IDF_PATH={os.path.abspath(idf_path)}"'])
897+
898+
cmds.append(submodules_cmd[:])
899+
900+
return_code, _ = spawn(cmds, env=env)
901+
if return_code != 0:
902+
sys.exit(return_code)
894903

895-
cmds.append([f'git submodule sync {path}'])
896-
cmds.append([f'git submodule update --init --depth=1 {path}'])
897904

898-
return_code, _ = spawn(cmds, env=env)
899-
if return_code != 0:
900-
sys.exit(return_code)
901-
902-
903905
def find_esp32_ports(chip):
904906
from esptool.targets import CHIP_DEFS # NOQA
905907
from esptool.util import FatalError # NOQA
@@ -977,10 +979,7 @@ def update_panic_handler():
977979
if '"MPY version : "' in data:
978980
beg, end = data.split('"MPY version : "', 1)
979981
end = end.split('"\\r\\n"', 1)[1]
980-
data = (
981-
f'{beg}"LVGL MPY version : 1.23.0 on " '
982-
f'MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN "\\r\\n"{end}'
983-
)
982+
data = f'{beg}"LVGL MicroPython \\r\\n"{end}'
984983

985984
write_file(PANICHANDLER_PATH, data)
986985

0 commit comments

Comments
 (0)