| #!/usr/bin/env python3 | |
| import json | |
| from pathlib import Path | |
| import yaml | |
| HEADER = """# Generated by generate_scanner_spec.py from scanner_spec.yaml | |
| # Do not edit by hand. | |
| """ | |
| def main() -> None: | |
| root = Path(__file__).resolve().parent | |
| spec_path = root / "scanner_spec.yaml" | |
| out_path = root / "irish_core_generated_scanner_spec.py" | |
| spec = yaml.safe_load(spec_path.read_text(encoding="utf-8")) | |
| out_path.write_text( | |
| HEADER + "SCANNER_SPEC = " + json.dumps(spec, indent=2, ensure_ascii=False) + "\n", | |
| encoding="utf-8", | |
| ) | |
| if __name__ == "__main__": | |
| main() | |