Anki/pylib/anki/buildinfo.py
RumovZ d665dbc9a7
PEP8 pylib (#1443)
* PEP8 scheduler/base.py

* PEP8 _backend/__init__.py

* PEP8 _backend/genbackend.py

* PEP8 _backend/genfluent.py

* PEP8 scheduler/__init__.py

* PEP8 __init__.py

* PEP8 _legacy.py

* PEP8 syncserver/__init__.py

- Make 'ip' a good name
- Overrule `global col` being identified as a constant

* PEP8 syncserver/__main__.py

* PEP8 buildinfo.py

* Implement `DeprecatedNamesMixin` for modules

* PEP8 browser.py

* PEP8 config.py

* PEP8 consts.py

* PEP8 db.py

* Format

* Improve AttributeError for DeprecatedNamesMixin

* print the line that imported/referenced the legacy module attr (dae)

* DeprecatedNamesMixinStandalone -> ...ForModule
2021-10-22 20:39:49 +10:00

23 lines
611 B
Python

# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
# pylint: enable=invalid-name
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:
key, val = elems
info[key] = val
return info
_buildinfo = _get_build_info()
buildhash = _buildinfo["STABLE_BUILDHASH"]
version = _buildinfo["STABLE_VERSION"]