1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 00:30:33 +03:00

Reorder cases

This commit is contained in:
David Muckle 2023-12-24 21:42:00 -05:00
parent 35ff88b83b
commit 3947c6af63

View File

@ -137,14 +137,15 @@ def appversion() -> semantic_version.Version:
shorthash = gitv.read() shorthash = gitv.read()
else: else:
# Running from source. For Linux, check to see if .gitversion file exists # Running from source. Use git rev-parse --short HEAD
# If so, use it. This is also required for the Flatpak # or fall back to .gitversion file if it exists.
if pathlib.Path(sys.path[0] + "/" + GITVERSION_FILE).exists(): # This is also required for the Flatpak
with open(pathlib.Path(sys.path[0] + "/" + GITVERSION_FILE), encoding='utf-8') as gitv: shorthash = git_shorthash_from_head()
shorthash = gitv.read() if shorthash is None:
else: if pathlib.Path(sys.path[0] + "/" + GITVERSION_FILE).exists():
shorthash = git_shorthash_from_head() with open(pathlib.Path(sys.path[0] + "/" + GITVERSION_FILE), encoding='utf-8') as gitv:
if shorthash is None: shorthash = gitv.read()
else:
shorthash = 'UNKNOWN' shorthash = 'UNKNOWN'
_cached_version = semantic_version.Version(f'{_static_appversion}+{shorthash}') _cached_version = semantic_version.Version(f'{_static_appversion}+{shorthash}')