From 7e557a8844915cde29c86d678e732bcc3c662154 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Mon, 2 Dec 2024 15:39:44 +0100 Subject: [PATCH] chore(core): adapt SConscripts to THP needs --- core/SConscript.firmware | 23 ++++++++++++++++------- core/SConscript.unix | 23 ++++++++++++++++------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/core/SConscript.firmware b/core/SConscript.firmware index bf7427ec61..ed3efec47b 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -578,14 +578,23 @@ if FROZEN: ] if not EVERYTHING else [] )) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/codec/*.py')) + if THP: + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/thp/*.py')) + if not THP or PYOPT == '0': + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/codec/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'storage/*.py', - exclude=[ - SOURCE_PY_DIR + 'storage/sd_salt.py', - ] if not SDCARD else [] - )) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/*.py')) + + + exclude_list = [] + if 'sd_card' not in FEATURES_AVAILABLE: + exclude_list.append(SOURCE_PY_DIR + 'storage/sd_salt.py') + if THP and PYOPT == '1': + exclude_list.append(SOURCE_PY_DIR + 'storage/cache_codec.py') + if not THP: + exclude_list.append(SOURCE_PY_DIR + 'storage/cache_thp.py') + + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'storage/*.py', exclude=exclude_list)) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/messages/__init__.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py', diff --git a/core/SConscript.unix b/core/SConscript.unix index a7d98ad47c..8a04c2217e 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -635,14 +635,23 @@ if FROZEN: ] if not EVERYTHING else [] )) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/codec/*.py')) + if THP: + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/thp/*.py')) + if not THP or PYOPT == '0': + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/codec/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'storage/*.py', - exclude=[ - SOURCE_PY_DIR + 'storage/sd_salt.py', - ] if 'sd_card' not in FEATURES_AVAILABLE else [] - )) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/*.py')) + + + exclude_list = [] + if 'sd_card' not in FEATURES_AVAILABLE: + exclude_list.append(SOURCE_PY_DIR + 'storage/sd_salt.py') + if THP and PYOPT == '1': + exclude_list.append(SOURCE_PY_DIR + 'storage/cache_codec.py') + if not THP: + exclude_list.append(SOURCE_PY_DIR + 'storage/cache_thp.py') + + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'storage/*.py', exclude=exclude_list)) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/messages/__init__.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py',