mirror of
https://github.com/djrobstep/migra.git
synced 2024-09-11 05:45:51 +03:00
24 lines
527 B
Python
24 lines
527 B
Python
from pathlib import Path
|
|
from time import time
|
|
|
|
from toml import TomlPreserveInlineDictEncoder as tpide
|
|
from toml import dumps, loads
|
|
|
|
PYPROJECT = "pyproject.toml"
|
|
|
|
p = Path(PYPROJECT)
|
|
pyproject = loads(p.read_text())
|
|
|
|
v = pyproject["tool"]["poetry"]["version"]
|
|
|
|
parts = v.split(".")[:2]
|
|
unix = str(int(time()))
|
|
|
|
parts.append(unix)
|
|
|
|
v_with_timestamp = ".".join(parts)
|
|
pyproject["tool"]["poetry"]["version"] = v_with_timestamp
|
|
p.write_text(dumps(pyproject, tpide()))
|
|
|
|
Path("~/version").expanduser().write_text(v_with_timestamp)
|