1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 13:01:12 +00:00

tools: we need to keep cointool py3.5 compatible

for T1 deterministic build (which happens in Debian 9 docker container)
This commit is contained in:
Pavol Rusnak 2018-09-19 20:13:05 +02:00
parent 92d87f9ba6
commit f60b722638
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -149,8 +149,8 @@ def highlight_key(coin, color):
else: else:
keylist[-1] = crayon(color, keylist[-1], bold=True) keylist[-1] = crayon(color, keylist[-1], bold=True)
key = crayon(color, ":".join(keylist)) key = crayon(color, ":".join(keylist))
name = crayon(None, f"({coin['name']})", dim=True) name = crayon(None, "({})".format(coin['name']), dim=True)
return f"{key} {name}" return "{} {}".format(key, name)
def find_collisions(coins, field): def find_collisions(coins, field):
@ -166,7 +166,7 @@ def check_eth(coins):
check_passed = True check_passed = True
chains = find_collisions(coins, "chain") chains = find_collisions(coins, "chain")
for key, bucket in chains.items(): for key, bucket in chains.items():
bucket_str = ", ".join(f"{coin['key']} ({coin['name']})" for coin in bucket) bucket_str = ", ".join("{} ({})".format(coin['key'], coin['name']) for coin in bucket)
chain_name_str = "colliding chain name " + crayon(None, key, bold=True) + ":" chain_name_str = "colliding chain name " + crayon(None, key, bold=True) + ":"
print_log(logging.ERROR, chain_name_str, bucket_str) print_log(logging.ERROR, chain_name_str, bucket_str)
check_passed = False check_passed = False
@ -237,7 +237,7 @@ def check_btc(coins):
else: else:
# collision between some unsupported networks is OK # collision between some unsupported networks is OK
level = logging.INFO level = logging.INFO
print_log(level, f"prefix {key}:", collision_str(bucket)) print_log(level, "prefix {}:".format(key), collision_str(bucket))
return failed return failed
@ -287,7 +287,7 @@ def check_dups(buckets, print_at_level=logging.ERROR):
prefix = crayon("green", "*", bold=True) prefix = crayon("green", "*", bold=True)
else: else:
prefix = "" prefix = ""
return f"{prefix}{highlighted}" return "{}{}".format(prefix, highlighted)
check_passed = True check_passed = True
@ -315,7 +315,7 @@ def check_dups(buckets, print_at_level=logging.ERROR):
if symbol == "_override": if symbol == "_override":
print_log(level, "force-set duplicates:", dup_str) print_log(level, "force-set duplicates:", dup_str)
else: else:
print_log(level, f"duplicate symbol {symbol}:", dup_str) print_log(level, "duplicate symbol {}:".format(symbol), dup_str)
return check_passed return check_passed
@ -387,10 +387,10 @@ def check_key_uniformity(coins):
keyset = set(coin.keys()) keyset = set(coin.keys())
missing = ", ".join(reference_keyset - keyset) missing = ", ".join(reference_keyset - keyset)
if missing: if missing:
print_log(logging.ERROR, f"coin {key} has missing keys: {missing}") print_log(logging.ERROR, "coin {} has missing keys: {}".format(key, missing))
additional = ", ".join(keyset - reference_keyset) additional = ", ".join(keyset - reference_keyset)
if additional: if additional:
print_log(logging.ERROR, f"coin {key} has superfluous keys: {additional}") print_log(logging.ERROR, "coin {} has superfluous keys: {}".format(key, additional))
return False return False