Skip to content

Commit

Permalink
change ComfyUI-Manager path from ComfyUI-Manager to comfyui-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed Jan 19, 2025
1 parent 98bfef7 commit 419bc37
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 12 deletions.
12 changes: 10 additions & 2 deletions comfy_cli/command/custom_nodes/cm_cli_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 34 in comfy_cli/command/custom_nodes/cm_cli_util.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/custom_nodes/cm_cli_util.py#L33-L34

Added lines #L33 - L34 were not covered by tests

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

Check warning on line 40 in comfy_cli/command/custom_nodes/cm_cli_util.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/custom_nodes/cm_cli_util.py#L36-L40

Added lines #L36 - L40 were not covered by tests

if cm_cli_path is None:

Check warning on line 42 in comfy_cli/command/custom_nodes/cm_cli_util.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/custom_nodes/cm_cli_util.py#L42

Added line #L42 was not covered by tests
print(
f"\n[bold red]ComfyUI-Manager not found: {cm_cli_path}[/bold red]\n",
file=sys.stderr,
Expand Down
13 changes: 12 additions & 1 deletion comfy_cli/command/custom_nodes/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 484 in comfy_cli/command/custom_nodes/command.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/custom_nodes/command.py#L483-L484

Added lines #L483 - L484 were not covered by tests

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

Check warning on line 490 in comfy_cli/command/custom_nodes/command.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/custom_nodes/command.py#L486-L490

Added lines #L486 - L490 were not covered by tests

if cm_cli_path is None:
typer.echo("ComfyUI-Manager is not installed.", err=True)
raise typer.Exit(code=1)

Check warning on line 494 in comfy_cli/command/custom_nodes/command.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/custom_nodes/command.py#L492-L494

Added lines #L492 - L494 were not covered by tests

tmp_path = os.path.join(config_manager.get_config_path(), "tmp")
if not os.path.exists(tmp_path):
Expand Down
21 changes: 15 additions & 6 deletions comfy_cli/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 153 in comfy_cli/command/install.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/install.py#L153

Added line #L153 was not covered by tests
subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True)


Expand Down Expand Up @@ -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

Check warning on line 227 in comfy_cli/command/install.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/install.py#L226-L227

Added lines #L226 - L227 were not covered by tests

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

Check warning on line 233 in comfy_cli/command/install.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/install.py#L229-L233

Added lines #L229 - L233 were not covered by tests

if manager_repo_dir is not None:

Check warning on line 235 in comfy_cli/command/install.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/install.py#L235

Added line #L235 was not covered by tests
if restore and not fast_deps:
pip_install_manager_dependencies(repo_dir)
pip_install_manager_dependencies(repo_dir, manager_repo_dir)

Check warning on line 237 in comfy_cli/command/install.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/install.py#L237

Added line #L237 was not covered by tests
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

Check warning on line 243 in comfy_cli/command/install.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/install.py#L243

Added line #L243 was not covered by tests

rprint("\nInstalling ComfyUI-Manager..")

if "@" in manager_url:
Expand All @@ -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)

Check warning on line 260 in comfy_cli/command/install.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/command/install.py#L260

Added line #L260 was not covered by tests

if fast_deps:
depComp = DependencyCompiler(cwd=repo_dir, gpu=gpu)
Expand Down
15 changes: 12 additions & 3 deletions comfy_cli/workspace_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,25 @@ 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

Check warning on line 267 in comfy_cli/workspace_manager.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/workspace_manager.py#L266-L267

Added lines #L266 - L267 were not covered by tests

if os.path.exists(manager_path_legacy):
manager_path = manager_path_legacy # if the legacy path exists

Check warning on line 270 in comfy_cli/workspace_manager.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/workspace_manager.py#L269-L270

Added lines #L269 - L270 were not covered by tests
else:
manager_path = manager_path_default # manager is not installed, or manager_path1 exists

Check warning on line 272 in comfy_cli/workspace_manager.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/workspace_manager.py#L272

Added line #L272 was not covered by tests

return manager_path

def is_comfyui_manager_installed(self):
if self.workspace_path is None:
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

Check warning on line 282 in comfy_cli/workspace_manager.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/workspace_manager.py#L281-L282

Added lines #L281 - L282 were not covered by tests

return os.path.exists(manager_path_default) or os.path.exists(manager_path_legacy)

Check warning on line 284 in comfy_cli/workspace_manager.py

View check run for this annotation

Codecov / codecov/patch

comfy_cli/workspace_manager.py#L284

Added line #L284 was not covered by tests

def scan_dir(self):
if not self.workspace_path:
Expand Down

0 comments on commit 419bc37

Please sign in to comment.