"""Generate the VKFly MAVLink 2 Python dialect from the checked-out submodule.""" from pathlib import Path import sys from pymavlink.generator import mavgen HERE = Path(__file__).resolve().parent xml = HERE / 'mavlink/msg_definitions/VKFly.xml' output = HERE / 'generated/vkfly.py' if not xml.is_file(): sys.exit(f'Missing MAVLink submodule definition: {xml}') output.parent.mkdir(parents=True, exist_ok=True) opts = mavgen.Opts(str(output), wire_protocol='2.0', language='Python', validate=True) if not mavgen.mavgen(opts, [str(xml)]): sys.exit('VKFly dialect generation failed') print(f'Generated {output}')