#!/usr/bin/env python3
"""
Check that lintsonschema's schema matches the "real" one.

This is the most straightforward way to keep things in sync that I can think
of. For why, see #521.
"""
from pathlib import Path
import sys

ROOT = Path(__file__).absolute().parent.parent
IO_SCHEMA = ROOT.joinpath("bowtie/schemas/io-schema.json").read_text()
IO_SCHEMA_COPY = ROOT / "tests/fauxmplementations/lintsonschema/io-schema.json"

if IO_SCHEMA_COPY.read_text() != IO_SCHEMA:
    IO_SCHEMA_COPY.write_text(IO_SCHEMA)
    sys.exit(
        "lintsonschema's io-schema.json drifted from the real one. Fixing...",
    )
