2022-07-17 00:53:59 +00:00
|
|
|
"""This script generates the python XAP client.
|
|
|
|
"""
|
2022-10-16 19:24:37 +00:00
|
|
|
from milc import cli
|
2022-07-17 00:53:59 +00:00
|
|
|
|
|
|
|
from qmk.commands import dump_lines
|
2022-10-16 19:24:37 +00:00
|
|
|
from qmk.constants import QMK_FIRMWARE
|
|
|
|
from qmk.xap.common import latest_xap_defs, render_xap_output
|
2022-07-17 00:53:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@cli.subcommand('Generates the python XAP client.', hidden=False if cli.config.user.developer else True)
|
|
|
|
def xap_generate_python(cli):
|
|
|
|
defs = latest_xap_defs()
|
|
|
|
|
|
|
|
parent = QMK_FIRMWARE / 'lib' / 'python' / 'xap_client'
|
2022-10-13 00:42:27 +00:00
|
|
|
for name in ['types.py', 'routes.py', 'constants.py']:
|
2022-07-17 00:53:59 +00:00
|
|
|
output = render_xap_output('client/python', f'{name}.j2', defs)
|
2022-10-16 19:24:37 +00:00
|
|
|
lines = output.split('\n')
|
2022-07-17 00:53:59 +00:00
|
|
|
|
|
|
|
dump_lines(parent / name, lines)
|