#!/usr/bin/python3
"""Write the model pairing lock for the dictionary in 0c-ime-data.

Usage: debian/pairing-lock <SHA-256 of the dictionary's manifest.json> <output>

The lock lists what the downloaded models must look like after 0c-update
pairs them with the dictionary.  It depends on models/models.lock.json here
and on the checksum of the dictionary's manifest.json, so it can be made
without the dictionary.  This uses upstream's scripts/pairing_lock.py.
"""
import sys
from pathlib import Path

sys.dont_write_bytecode = True
sys.path.insert(0, "scripts")
import pairing_lock  # noqa: E402

Path(sys.argv[2]).write_bytes(pairing_lock.pairing_lock(sys.argv[1]))
