Skip to content

Commit 272db5d

Browse files
committed
bugfix
1 parent 516a76b commit 272db5d

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/seedsigner/helpers/version.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def get_last_edit_timestamp(cls) -> datetime:
200200
201201
Uses the last git commit time (via `git log`) as the last edit time.
202202
"""
203-
version_info = dict(version=Version.get_version())
203+
version_info = dict()
204204

205205
# Run `git log` in the shell to get the last commit time
206206
try:
@@ -211,18 +211,25 @@ def get_last_edit_timestamp(cls) -> datetime:
211211
raise Exception("Could not get last commit time from git log.") from e
212212

213213
try:
214-
version_name = None
215-
216214
# If we're currently building SeedSigner OS, check the env var
217215
version_name = os.getenv("SEEDSIGNER_VERSION_NAME")
218-
print(f"SEEDSIGNER_VERSION_NAME={version_name}")
219216

220217
if not version_name:
221218
version_name = os.popen("git branch --show-current").read().strip()
222-
if not version_name:
223-
# If we're on a tag, there won't be a current branch. Instead, try to get the
224-
# current tag.
225-
version_name = os.popen("git describe --tags --abbrev=0").read().strip()
219+
220+
if not version_name:
221+
# If we're on a tag, there won't be a current branch. Instead, try to get the
222+
# current tag.
223+
version_name = os.popen("git describe --tags --abbrev=0").read().strip()
224+
225+
if not version_name:
226+
# Fallback to commit hash
227+
version_name = os.popen("git rev-parse --short HEAD").read().strip()
228+
229+
if not version_name:
230+
raise Exception("No git info found for version name.")
231+
232+
version_info["version"] = version_name
226233
except Exception as e:
227234
raise Exception("Could not get version name from SeedSigner OS env var nor git.") from e
228235

0 commit comments

Comments
 (0)