Fix get version git fallback

This commit is contained in:
huchenlei 2024-08-30 10:35:09 -04:00
parent 21122f9965
commit d833512213

View File

@ -44,17 +44,17 @@ async def send_socket_catch_exception(function, message):
def get_comfyui_version():
comfyui_version = "unknown"
repo_path = os.path.dirname(os.path.realpath(__file__))
try:
import pygit2
repo_path = os.path.dirname(os.path.realpath(__file__))
repo = pygit2.Repository(repo_path)
comfyui_version = repo.describe(describe_strategy=pygit2.GIT_DESCRIBE_TAGS)
except Exception:
try:
import subprocess
comfyui_version = subprocess.check_output(["git", "describe", "--tags"], cwd=repo_path)
except Exception:
pass
except Exception as e:
logging.warning(f"Failed to get ComfyUI version: {e}")
return comfyui_version.strip()
@web.middleware