utils: add support for package version retreival
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
a3121775fc
commit
f48c18bfda
|
@ -87,8 +87,15 @@ def retrieve_git_version(source_path: str) -> str:
|
|||
return f"t{tag}-g{ver}-shallow"
|
||||
|
||||
def get_software_version() -> str:
|
||||
version = "?"
|
||||
|
||||
version: str = "?"
|
||||
try:
|
||||
import moonraker.__version__ as ver # type: ignore
|
||||
version = ver.__version__
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
if version:
|
||||
return version
|
||||
try:
|
||||
version = retrieve_git_version(MOONRAKER_PATH)
|
||||
except Exception:
|
||||
|
|
Loading…
Reference in New Issue