diff --git a/comfy_cli/command/custom_nodes/cm_cli_util.py b/comfy_cli/command/custom_nodes/cm_cli_util.py index 78f3370..2467ed9 100644 --- a/comfy_cli/command/custom_nodes/cm_cli_util.py +++ b/comfy_cli/command/custom_nodes/cm_cli_util.py @@ -30,8 +30,16 @@ def execute_cm_cli(args, channel=None, fast_deps=False, mode=None) -> str | None print("\n[bold red]ComfyUI path is not resolved.[/bold red]\n", file=sys.stderr) raise typer.Exit(code=1) - cm_cli_path = os.path.join(workspace_path, "custom_nodes", "ComfyUI-Manager", "cm-cli.py") - if not os.path.exists(cm_cli_path): + cm_cli_path1 = os.path.join(workspace_path, "custom_nodes", "comfyui-manager", "cm-cli.py") # path since CNR. + cm_cli_path2 = os.path.join(workspace_path, "custom_nodes", "ComfyUI-Manager", "cm-cli.py") # legacy path + + cm_cli_path = None + if os.path.exists(cm_cli_path1): + cm_cli_path = cm_cli_path1 + elif os.path.exists(cm_cli_path2): + cm_cli_path = cm_cli_path2 + + if cm_cli_path is None: print( f"\n[bold red]ComfyUI-Manager not found: {cm_cli_path}[/bold red]\n", file=sys.stderr, diff --git a/comfy_cli/command/custom_nodes/command.py b/comfy_cli/command/custom_nodes/command.py index b536eaa..73867e3 100644 --- a/comfy_cli/command/custom_nodes/command.py +++ b/comfy_cli/command/custom_nodes/command.py @@ -480,7 +480,18 @@ def update_node_id_cache(): config_manager = ConfigManager() workspace_path = workspace_manager.workspace_path - cm_cli_path = os.path.join(workspace_path, "custom_nodes", "ComfyUI-Manager", "cm-cli.py") + cm_cli_path1 = os.path.join(workspace_path, "custom_nodes", "comfyui-manager", "cm-cli.py") # path since CNR. + cm_cli_path2 = os.path.join(workspace_path, "custom_nodes", "ComfyUI-Manager", "cm-cli.py") # legacy path + + cm_cli_path = None + if os.path.exists(cm_cli_path1): + cm_cli_path = cm_cli_path1 + elif os.path.exists(cm_cli_path2): + cm_cli_path = cm_cli_path2 + + if cm_cli_path is None: + typer.echo("ComfyUI-Manager is not installed.", err=True) + raise typer.Exit(code=1) tmp_path = os.path.join(config_manager.get_config_path(), "tmp") if not os.path.exists(tmp_path): diff --git a/comfy_cli/command/install.py b/comfy_cli/command/install.py index 7a50067..447d838 100755 --- a/comfy_cli/command/install.py +++ b/comfy_cli/command/install.py @@ -149,8 +149,8 @@ def pip_install_comfyui_dependencies( # install requirements for manager -def pip_install_manager_dependencies(repo_dir): - os.chdir(os.path.join(repo_dir, "custom_nodes", "ComfyUI-Manager")) +def pip_install_manager_dependencies(repo_dir, manager_repo_dir): + os.chdir(manager_repo_dir) subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True) @@ -223,16 +223,25 @@ def execute( if skip_manager: rprint("Skipping installation of ComfyUI-Manager. (by --skip-manager)") else: - manager_repo_dir = os.path.join(repo_dir, "custom_nodes", "ComfyUI-Manager") + manager_repo_dir1 = os.path.join(repo_dir, "custom_nodes", "comfyui-manager") # path since CNR. + manager_repo_dir2 = os.path.join(repo_dir, "custom_nodes", "ComfyUI-Manager") # legacy path - if os.path.exists(manager_repo_dir): + manager_repo_dir = None + if os.path.exists(manager_repo_dir1): + manager_repo_dir = manager_repo_dir1 + elif os.path.exists(manager_repo_dir2): + manager_repo_dir = manager_repo_dir2 + + if manager_repo_dir is not None: if restore and not fast_deps: - pip_install_manager_dependencies(repo_dir) + pip_install_manager_dependencies(repo_dir, manager_repo_dir) else: rprint( f"Directory {manager_repo_dir} already exists. Skipping installation of ComfyUI-Manager.\nIf you want to restore dependencies, add the '--restore' option." ) else: + manager_repo_dir = manager_repo_dir1 + rprint("\nInstalling ComfyUI-Manager..") if "@" in manager_url: @@ -248,7 +257,7 @@ def execute( subprocess.run(["git", "checkout", manager_commit], check=True, cwd=manager_repo_dir) if not fast_deps: - pip_install_manager_dependencies(repo_dir) + pip_install_manager_dependencies(repo_dir, manager_repo_dir) if fast_deps: depComp = DependencyCompiler(cwd=repo_dir, gpu=gpu) diff --git a/comfy_cli/workspace_manager.py b/comfy_cli/workspace_manager.py index fc5f451..2d8f2b1 100644 --- a/comfy_cli/workspace_manager.py +++ b/comfy_cli/workspace_manager.py @@ -263,7 +263,14 @@ def get_comfyui_manager_path(self): return None # To check more robustly, verify up to the `.git` path. - manager_path = os.path.join(self.workspace_path, "custom_nodes", "ComfyUI-Manager") + manager_path_default = os.path.join(self.workspace_path, "custom_nodes", "comfyui-manager") # path since CNR + manager_path_legacy = os.path.join(self.workspace_path, "custom_nodes", "ComfyUI-Manager") # legacy path + + if os.path.exists(manager_path_legacy): + manager_path = manager_path_legacy # if the legacy path exists + else: + manager_path = manager_path_default # manager is not installed, or manager_path1 exists + return manager_path def is_comfyui_manager_installed(self): @@ -271,8 +278,10 @@ def is_comfyui_manager_installed(self): return False # To check more robustly, verify up to the `.git` path. - manager_git_path = os.path.join(self.workspace_path, "custom_nodes", "ComfyUI-Manager", ".git") - return os.path.exists(manager_git_path) + manager_path_default = os.path.join(self.workspace_path, "custom_nodes", "comfyui-manager", ".git") # path since CNR + manager_path_legacy = os.path.join(self.workspace_path, "custom_nodes", "ComfyUI-Manager", ".git") # legacy path + + return os.path.exists(manager_path_default) or os.path.exists(manager_path_legacy) def scan_dir(self): if not self.workspace_path: