From d912012f76ebaeafb5f48080be86e1447587dc4d Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 19 Mar 2025 13:59:55 +0500 Subject: [PATCH] Bonsai makefile - fill last_commit_date Also .isoformat(), so string would match exactly with the one git command provides. --- src/bonsai/Makefile | 2 ++ src/bonsai/bonsai/__init__.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/bonsai/Makefile b/src/bonsai/Makefile index 90867ff0ec..8933f14290 100644 --- a/src/bonsai/Makefile +++ b/src/bonsai/Makefile @@ -46,6 +46,7 @@ VERSION_MINOR:=$(shell cat '../../VERSION' | cut -d '.' -f 2) VERSION_PATCH:=$(shell cat '../../VERSION' | cut -d '.' -f 3) VERSION_DATE:=$(shell date '+%y%m%d') LAST_COMMIT_HASH:=$(shell git rev-parse HEAD) +LAST_COMMIT_DATE:=$(shell git show -s --format=%cI) PYVERSION:=py310 PYPI_IMP:=cp @@ -254,6 +255,7 @@ ifeq ($(IS_STABLE), TRUE) else $(SED) "s/0.0.0/$(VERSION)-alpha$(VERSION_DATE)/" build/bonsai/blender_manifest.toml $(SED) "s/8888888/$(LAST_COMMIT_HASH)/" build/bonsai/__init__.py + $(SED) "s/9999999/$(LAST_COMMIT_DATE)/" build/bonsai/__init__.py $(SED) 's/version = "0.0.0"/version = "$(VERSION)-alpha$(VERSION_DATE)"/' build/pyproject.toml endif diff --git a/src/bonsai/bonsai/__init__.py b/src/bonsai/bonsai/__init__.py index 11cb6208d4..6ea48885b3 100644 --- a/src/bonsai/bonsai/__init__.py +++ b/src/bonsai/bonsai/__init__.py @@ -40,7 +40,7 @@ from typing import Union, Any, Generator last_commit_hash = "8888888" -last_commit_date = None +last_commit_date = "9999999" def get_last_commit_hash() -> Union[str, None]: @@ -52,6 +52,12 @@ def get_last_commit_hash() -> Union[str, None]: return last_commit_hash[:7] +def get_last_commit_date() -> Union[str, None]: + if last_commit_date == str(9_999999): + return None + return last_commit_date + + # Accessed from bonsai extension: bbim_semver: dict[str, Any] = {} @@ -97,7 +103,7 @@ def get_debug_info(): "blender_version": bpy.app.version_string, "bonsai_version": bbim_version, "bonsai_commit_hash": get_last_commit_hash(), - "bonsai_commit_date": last_commit_date, + "bonsai_commit_date": get_last_commit_date(), "last_actions": last_actions, "last_error": last_error, } @@ -220,7 +226,7 @@ if IN_BLENDER: path = Path(__file__).resolve().parent repo = git.Repo(str(path), search_parent_directories=True) last_commit_hash = repo.head.object.hexsha - last_commit_date = repo.head.object.committed_datetime.strftime("%Y-%m-%d %H:%M:%S") + last_commit_date = repo.head.object.committed_datetime.isoformat() except: pass