generate_python.py 646 B

12345678910111213141516171819
  1. """This script generates the python XAP client.
  2. """
  3. from milc import cli
  4. from qmk.commands import dump_lines
  5. from qmk.constants import QMK_FIRMWARE
  6. from qmk.xap.common import latest_xap_defs, render_xap_output
  7. @cli.subcommand('Generates the python XAP client.', hidden=False if cli.config.user.developer else True)
  8. def xap_generate_python(cli):
  9. defs = latest_xap_defs()
  10. parent = QMK_FIRMWARE / 'lib' / 'python' / 'xap_client'
  11. for name in ['types.py', 'routes.py', 'constants.py']:
  12. output = render_xap_output('client/python', f'{name}.j2', defs)
  13. lines = output.split('\n')
  14. dump_lines(parent / name, lines)