diff --git a/__init__.py b/__init__.py index 728a4a0e..a3b2e649 100644 --- a/__init__.py +++ b/__init__.py @@ -1,10 +1,12 @@ import os +import sys cli_mode_flag = os.path.join(os.path.dirname(__file__), '.enable-cli-only-mode') if not os.path.exists(cli_mode_flag): - from .glob import manager_server - from .glob import share_3rdparty + sys.path.append(os.path.join(os.path.dirname(__file__), "glob")) + import manager_server + import share_3rdparty WEB_DIRECTORY = "js" else: print(f"\n[ComfyUI-Manager] !! cli-only-mode is enabled !!\n") diff --git a/glob/manager_core.py b/glob/manager_core.py index 7c1fae7d..88170b8b 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -23,7 +23,7 @@ sys.path.append(glob_path) import cm_global from manager_util import * -version = [2, 54] +version = [2, 55] version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') @@ -52,9 +52,21 @@ def get_custom_nodes_paths(): return [custom_nodes_path] +def get_comfyui_tag(): + repo = git.Repo(comfy_path) + try: + return repo.git.describe('--tags') + except: + return None + + comfy_path = os.environ.get('COMFYUI_PATH') if comfy_path is None: - comfy_path = os.path.abspath(os.path.join(custom_nodes_path, '..')) + try: + import folder_paths + comfy_path = os.path.join(os.path.dirname(folder_paths.__file__)) + except: + comfy_path = os.path.abspath(os.path.join(custom_nodes_path, '..')) channel_list_path = os.path.join(comfyui_manager_path, 'channels.list') config_path = os.path.join(comfyui_manager_path, "config.ini") diff --git a/glob/manager_server.py b/glob/manager_server.py index 60e03236..0b39db44 100644 --- a/glob/manager_server.py +++ b/glob/manager_server.py @@ -181,7 +181,7 @@ def print_comfyui_version(): try: if core.comfy_ui_commit_datetime.date() < core.comfy_ui_required_commit_datetime.date(): - print(f"\n\n## [WARN] ComfyUI-Manager: Your ComfyUI version ({core.comfy_ui_revision})[{core.comfy_ui_commit_datetime.date()}] is too old. Please update to the latest version. ##\n\n") + print(f"\n\n## [WARN] ComfyUI-Manager: Your ComfyUI version ({core.get_comfyui_tag()})[{core.comfy_ui_commit_datetime.date()}] is too old. Please update to the latest version. ##\n\n") except: pass @@ -200,7 +200,11 @@ def print_comfyui_version(): # <-- if current_branch == "master": - print(f"### ComfyUI Revision: {core.comfy_ui_revision} [{comfy_ui_hash[:8]}] | Released on '{core.comfy_ui_commit_datetime.date()}'") + version_tag = core.get_comfyui_tag() + if version_tag is None: + print(f"### ComfyUI Revision: {core.comfy_ui_revision} [{comfy_ui_hash[:8]}] | Released on '{core.comfy_ui_commit_datetime.date()}'") + else: + print(f"### ComfyUI Version: {core.get_comfyui_tag()} | Released on '{core.comfy_ui_commit_datetime.date()}'") else: print(f"### ComfyUI Revision: {core.comfy_ui_revision} on '{current_branch}' [{comfy_ui_hash[:8]}] | Released on '{core.comfy_ui_commit_datetime.date()}'") except: @@ -1203,14 +1207,21 @@ async def get_notice(request): if match: markdown_content = match.group(1) - markdown_content += f"
ComfyUI: {core.comfy_ui_revision}[{comfy_ui_hash[:6]}]({core.comfy_ui_commit_datetime.date()})" + version_tag = core.get_comfyui_tag() + if version_tag is None: + markdown_content += f"
ComfyUI: {core.comfy_ui_revision}[{comfy_ui_hash[:6]}]({core.comfy_ui_commit_datetime.date()})" + else: + markdown_content += (f"
ComfyUI: {version_tag}
" + f"         ({core.comfy_ui_commit_datetime.date()})") # markdown_content += f"
         ()" markdown_content += f"
Manager: {core.version_str}" markdown_content = add_target_blank(markdown_content) try: - if core.comfy_ui_required_commit_datetime.date() > core.comfy_ui_commit_datetime.date(): + if core.comfy_ui_commit_datetime == datetime(1900, 1, 1, 0, 0, 0): + markdown_content = f'

Your ComfyUI isn\'t git repo.

' + markdown_content + elif core.comfy_ui_required_commit_datetime.date() > core.comfy_ui_commit_datetime.date(): markdown_content = f'

Your ComfyUI is too OUTDATED!!!

' + markdown_content except: pass diff --git a/pyproject.toml b/pyproject.toml index 88dd09b2..5dcb0800 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-manager" description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI." -version = "2.54" +version = "2.55" license = { file = "LICENSE.txt" } dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]