Anki/pylib/anki/buildinfo.py
2021-10-12 16:27:57 +10:00

21 lines
572 B
Python

# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from importlib.resources import open_text
def _get_build_info() -> dict[str, str]:
info = {}
with open_text("anki", "buildinfo.txt") as file:
for line in file.readlines():
elems = line.split()
if len(elems) == 2:
k, v = elems
info[k] = v
return info
_buildinfo = _get_build_info()
buildhash = _buildinfo["STABLE_BUILDHASH"]
version = _buildinfo["STABLE_VERSION"]