0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-22 04:59:34 +01:00
mongodb/evergreen/functions/poetry_lock_check.py
Daniel Moody f7b1f4cf37 SERVER-92914 upgrade to poetry 1.8.3 (#25404)
GitOrigin-RevId: 60610321c80f79e5c352fa455e774c7fc6d3592e
2024-07-26 21:35:01 +00:00

23 lines
854 B
Python

#!/usr/bin/env python3
"""
Check to make sure poetry.lock is synced with pyproject.toml.
Returns nonzero if poetry.lock and pyproject.toml are not synced
"""
import subprocess
POETRY_LOCK_V183 = (
"""# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand."""
)
# This has a great error message as part of the failure case
subprocess.run(["poetry", "check", "--lock"], check=True)
# Check if the poetry lock file was generated with poetry 1.8.3
with open("poetry.lock", "r") as poetry_lock:
if POETRY_LOCK_V183 not in poetry_lock.read(len(POETRY_LOCK_V183)):
raise Exception("""Poetry lockfile was not generated by poetry 1.8.3.
Make sure to have poetry 1.8.3 installed when running poetry lock.
If you are seeing this message please follow the poetry install steps in docs/building.md.""")