1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-20 21:38:26 +00:00
trezor-firmware/core/tools/build_solana_templates.py
gabrielkerekes b3f4b6ac2b feat(solana): add solana templates
- code is broken because depending modules are added in the next commit
2023-12-05 22:11:41 +01:00

23 lines
607 B
Python
Executable File

# !/usr/bin/env python3
from json import load
import click
from mako.template import Template
from munch import munchify
@click.command()
@click.argument("template_path", type=str)
@click.option("-p", "--programs-file", type=click.File(mode="r"), default="-")
@click.option("-o", "--out-file", type=click.File(mode="w"), default="-")
def render(template_path, programs_file, out_file):
programs = munchify(load(programs_file))
template = Template(filename=f"{template_path}/instructions.py.mako")
out_file.write(template.render(programs=programs))
if __name__ == "__main__":
render()