1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 11:28:14 +00:00

defs: add filter to build_coins.py

This commit is contained in:
Pavol Rusnak 2018-05-30 13:39:19 +02:00
parent aed1d7632f
commit 8ea2d04478
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -148,7 +148,7 @@ def convert_icon(icon):
def process_json(fn): def process_json(fn):
print(fn, end=' ... ') print(os.path.basename(fn), end=' ... ')
j = json.load(open(fn)) j = json.load(open(fn))
if BUILD_DEFS: if BUILD_DEFS:
i = Image.open(fn.replace('.json', '.png')) i = Image.open(fn.replace('.json', '.png'))
@ -164,12 +164,22 @@ def process_json(fn):
return j, None return j, None
scriptdir = os.path.dirname(os.path.realpath(__file__))
if len(sys.argv) > 1 and not sys.argv[1].startswith('-'):
support_json = json.load(open(scriptdir + '/../../support.json'))
support_list = support_json[sys.argv[1]].keys()
else:
support_list = None
coins = {} coins = {}
defs = {} defs = {}
scriptdir = os.path.dirname(os.path.realpath(__file__))
for fn in glob.glob(scriptdir + '/../*.json'): for fn in glob.glob(scriptdir + '/../*.json'):
c, d = process_json(fn) c, d = process_json(fn)
n = c['coin_name'] n = c['coin_name']
if support_list is None or n in support_list:
coins[n] = c coins[n] = c
defs[n] = d defs[n] = d