parameterize get_version and add get_release_notes function (#31922)

version
This commit is contained in:
Justin Newberry
2024-03-19 15:58:30 -04:00
committed by GitHub
parent 4fbc8a3896
commit 018b6d0fae
+8 -3
View File
@@ -16,12 +16,17 @@ training_version: bytes = b"0.2.0"
terms_version: bytes = b"2"
@cache
def get_version() -> str:
with open(os.path.join(BASEDIR, "common", "version.h")) as _versionf:
def get_version(path: str = BASEDIR) -> str:
with open(os.path.join(path, "common", "version.h")) as _versionf:
version = _versionf.read().split('"')[1]
return version
def get_release_notes(path: str = BASEDIR) -> str:
with open(os.path.join(path, "RELEASES.md"), "r") as f:
return f.read().split('\n\n', 1)[0]
@cache
def get_short_version() -> str:
return get_version().split('-')[0]