"""Keep the old Chinese vLLM guide URL as a full, generated Markdown mirror.""" import argparse from pathlib import Path import sys ROOT = Path(__file__).resolve().parents[1] SOURCE = ROOT / "docs/vllm_guide_zh.md" TARGET = ROOT / "docs/vllm_guide_zh_v2.md" NOTICE = ( "\n" "> This compatibility page is generated from the " "[maintained Chinese guide](./vllm_guide_zh.md). " "Edit that source and run `python scripts/sync_vllm_guide.py`.\n\n" ).encode("utf-8") def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--check", action="store_true", help="Fail on drift without writing") args = parser.parse_args() try: expected = NOTICE + SOURCE.read_bytes() if args.check: if not TARGET.is_file() or TARGET.read_bytes() != expected: print("Run python scripts/sync_vllm_guide.py to update the mirror.", file=sys.stderr) return 1 else: TARGET.write_bytes(expected) except OSError as error: print(str(error), file=sys.stderr) return 1 return 0 if __name__ == "__main__": raise SystemExit(main())