check_dialect.py 538 B

1234567891011121314151617181920212223
  1. """Verify the committed generated dialect matches the dialect submodule XML.
  2. Intended for pre-commit hooks and CI. Exits nonzero when regeneration is needed.
  3. """
  4. import sys
  5. from pathlib import Path
  6. sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
  7. from tools import gen_dialect
  8. def main() -> int:
  9. try:
  10. gen_dialect.generate(check=True, no_validate=True)
  11. except SystemExit as exc:
  12. print(exc, file=sys.stderr)
  13. return 1
  14. return 0
  15. if __name__ == "__main__":
  16. raise SystemExit(main())