mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-21 21:00:58 +00:00
fix(core): properly exclude altcoins from all_modules
This commit is contained in:
parent
a58823cc0c
commit
cbe4e0e725
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,35 @@ PATTERNS = (
|
|||||||
"apps/**/*.py",
|
"apps/**/*.py",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ALTCOINS = (
|
||||||
|
"binance",
|
||||||
|
"cardano",
|
||||||
|
"eos",
|
||||||
|
"ethereum",
|
||||||
|
"lisk",
|
||||||
|
"monero",
|
||||||
|
"nem",
|
||||||
|
"ripple",
|
||||||
|
"stellar",
|
||||||
|
"tezos",
|
||||||
|
"webauthn",
|
||||||
|
)
|
||||||
|
|
||||||
pyfiles = chain.from_iterable(sorted(SRCDIR.glob(p)) for p in PATTERNS)
|
pyfiles = chain.from_iterable(sorted(SRCDIR.glob(p)) for p in PATTERNS)
|
||||||
|
|
||||||
|
def make_import_name(pyfile):
|
||||||
|
importfile = pyfile.relative_to(SRCDIR)
|
||||||
|
if importfile.name == "__init__.py":
|
||||||
|
import_name = str(importfile.parent)
|
||||||
|
else:
|
||||||
|
import_name = str(importfile.with_suffix(""))
|
||||||
|
return import_name.replace("/", ".")
|
||||||
|
|
||||||
|
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]
|
||||||
|
|
||||||
%>\
|
%>\
|
||||||
from trezor.utils import halt
|
from trezor.utils import halt
|
||||||
|
|
||||||
@ -44,19 +72,19 @@ halt("Tried to import excluded module.")
|
|||||||
# interned, and some operation somewhere (rendering?) is reading strings character by
|
# interned, and some operation somewhere (rendering?) is reading strings character by
|
||||||
# character.
|
# character.
|
||||||
|
|
||||||
% for pyfile in pyfiles:
|
from trezor import utils
|
||||||
<%
|
|
||||||
pyfile = pyfile.relative_to(SRCDIR)
|
% for import_name in imports_common:
|
||||||
if pyfile.name == "__init__.py":
|
|
||||||
import_name = str(pyfile.parent)
|
|
||||||
else:
|
|
||||||
import_name = str(pyfile.with_suffix(""))
|
|
||||||
import_name = import_name.replace("/", ".")
|
|
||||||
%>\
|
|
||||||
${import_name}
|
${import_name}
|
||||||
import ${import_name}
|
import ${import_name}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
|
if utils.BITCOIN_ONLY:
|
||||||
|
% for import_name in imports_altcoin:
|
||||||
|
${import_name}
|
||||||
|
import ${import_name}
|
||||||
|
% endfor
|
||||||
|
|
||||||
# generate full alphabet
|
# generate full alphabet
|
||||||
<%
|
<%
|
||||||
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
|
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
|
||||||
|
Loading…
Reference in New Issue
Block a user