generate_python.py 731 B

12345678910111213141516171819202122
  1. """This script generates the python XAP client.
  2. """
  3. from qmk.constants import QMK_FIRMWARE, GPL2_HEADER_SH_LIKE, GENERATED_HEADER_SH_LIKE
  4. from qmk.xap.common import latest_xap_defs, render_xap_output
  5. from qmk.commands import dump_lines
  6. from milc import cli
  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']:
  12. lines = [GPL2_HEADER_SH_LIKE, GENERATED_HEADER_SH_LIKE]
  13. output = render_xap_output('client/python', f'{name}.j2', defs)
  14. lines += output.split('\n')
  15. dump_lines(parent / name, lines)