1
0

check_lockfile.py 625 B

1234567891011121314151617181920212223
  1. #! /usr/bin/env python
  2. import sys
  3. if sys.version_info < (3, 11):
  4. raise RuntimeError("Requires at least Python 3.11, to import tomllib")
  5. import tomllib
  6. with open("poetry.lock", "rb") as f:
  7. lockfile = tomllib.load(f)
  8. try:
  9. lock_version = lockfile["metadata"]["lock-version"]
  10. assert lock_version == "2.0"
  11. except Exception:
  12. print(
  13. """\
  14. Lockfile is not version 2.0. You probably need to upgrade poetry on your local box
  15. and re-run `poetry lock --no-update`. See the Poetry cheat sheet at
  16. https://matrix-org.github.io/synapse/develop/development/dependencies.html
  17. """
  18. )
  19. raise