From 6f84e39a4a675512d115aba153a70cefed231770 Mon Sep 17 00:00:00 2001 From: David Muckle Date: Sun, 24 Dec 2023 11:25:37 -0500 Subject: [PATCH] Proper check for .gitversion --- config/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/__init__.py b/config/__init__.py index 25acc41a..860e9750 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -139,10 +139,12 @@ def appversion() -> semantic_version.Version: else: # Running from source. For Linux, check to see if .gitversion file exists # If so, use it. This is also required for the Flatpak - if pathlib.Path("./" + GITVERSION_FILE).is_file(): - with open(pathlib.Path("./" + GITVERSION_FILE)) as gitv: + if pathlib.Path(sys.path[0] + "/" + GITVERSION_FILE).exists(): + print("Found .gitversion") + with open(pathlib.Path(sys.path[0] + "/" + GITVERSION_FILE), encoding='utf-8') as gitv: shorthash = gitv.read() else: + print("Did not find .gitversion in " + sys.path[0] + "/" + GITVERSION_FILE) shorthash = git_shorthash_from_head() if shorthash is None: shorthash = 'UNKNOWN'