mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-15 12:08:59 +00:00
build(core/translations): check order.json for holes
[no changelog]
This commit is contained in:
parent
79cf4959d3
commit
b40ce852ea
@ -239,6 +239,7 @@ translations: ## update translations
|
||||
python ./translations/cli.py gen
|
||||
|
||||
translations_check: ## check that translations are up to date
|
||||
python ./translations/order.py --check
|
||||
python ./translations/cli.py gen --check
|
||||
# spits out error if the stored merkle root is not up to date
|
||||
python ./translations/cli.py merkle-root > /dev/null
|
||||
|
@ -1,9 +1,11 @@
|
||||
from __future__ import annotations
|
||||
import json
|
||||
import os
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
|
||||
HERE = Path(__file__).parent
|
||||
|
||||
language_file = HERE / "en.json"
|
||||
@ -36,5 +38,22 @@ def generate_new_order() -> None:
|
||||
print("No new items found.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def check_order() -> None:
|
||||
old_order: dict[str, str] = json.loads(output_file.read_text())
|
||||
keys = { int(k) for k in old_order.keys() }
|
||||
for i in range(len(old_order)):
|
||||
if i not in keys:
|
||||
raise ValueError(f"order.json is missing index {i}")
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option("--check", is_flag=True, help="Do not modify order.json, only check if it's valid.")
|
||||
def main(check: bool | None) -> None:
|
||||
check_order()
|
||||
if check:
|
||||
sys.exit(0)
|
||||
generate_new_order()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user