1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

chore(core): exclude THP modules and messages from non-THP builds

[no changelog]
This commit is contained in:
M1nd3r 2024-10-08 23:21:20 +02:00 committed by Petr Sedláček
parent 7a7688514a
commit 6ba75b267d
3 changed files with 29 additions and 5 deletions

View File

@ -473,9 +473,15 @@ env.Replace(
#
PROTO_SOURCES_DIR = '../../../common/protob/'
exclude_list = [PROTO_SOURCES_DIR + 'messages-bootloader.proto']
if not THP:
exclude_list.append(PROTO_SOURCES_DIR + 'messages-thp.proto')
PROTO_SOURCES = Glob(PROTO_SOURCES_DIR + '*.proto',
exclude=[PROTO_SOURCES_DIR + 'messages-bootloader.proto']
exclude=exclude_list
)
qstr_protobuf = env.Command(
target=[
'genhdr/qstrdefs.protobuf.h',
@ -652,6 +658,9 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/tezos/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Tezos*.py'))
if THP:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/thp/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/zcash/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/webauthn/*.py'))

View File

@ -551,9 +551,15 @@ env.Replace(
#
PROTO_SOURCES_DIR = '../../../common/protob/'
exclude_list = [PROTO_SOURCES_DIR + 'messages-bootloader.proto']
if not THP:
exclude_list.append(PROTO_SOURCES_DIR + 'messages-thp.proto')
PROTO_SOURCES = Glob(PROTO_SOURCES_DIR + '*.proto',
exclude=[PROTO_SOURCES_DIR + 'messages-bootloader.proto']
exclude=exclude_list
)
qstr_protobuf = env.Command(
target=[
'genhdr/qstrdefs.protobuf.h',
@ -733,6 +739,9 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/tezos/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Tezos*.py'))
if THP:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/thp/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/zcash/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/webauthn/*.py'))

View File

@ -43,8 +43,9 @@ def make_import_name(pyfile):
imports = [make_import_name(f) for f in pyfiles]
imports_common = [import_name for import_name in imports if not any(a in import_name.lower() for a in ALTCOINS)]
imports_altcoin = [import_name for import_name in imports if import_name not in imports_common]
imports_thp = [import_name for import_name in imports if ".thp" in import_name.lower()]
imports_common = [import_name for import_name in imports if (not any(a in import_name.lower() for a in ALTCOINS) and import_name not in imports_thp)]
imports_altcoin = [import_name for import_name in imports if import_name not in imports_common and import_name not in imports_thp]
%>\
from trezor.utils import halt
@ -79,12 +80,17 @@ ${import_name}
import ${import_name}
% endfor
if utils.USE_THP:
% for import_name in imports_thp:
${import_name}
import ${import_name}
% endfor
if not utils.BITCOIN_ONLY:
% for import_name in imports_altcoin:
${import_name}
import ${import_name}
% endfor
# generate full alphabet
<%
ALPHABET = "abcdefghijklmnopqrstuvwxyz"