Bypass ComfyUI version check when in electron env (#1303)
* Hacky: hide the features we do not want to ship with electron app * Backup * Take install path for cm-cli. * Remove unused. * Add no deps. * Add no deps. * Bypass ComfyUI version check when in electron env * Fix exception when comfyui is not repo * Fix version reporting always skipped * Log unhandled errors --------- Co-authored-by: Yoland Y <4950057+yoland68@users.noreply.github.com> Co-authored-by: Robin Huang <robin.j.huang@gmail.com>
This commit is contained in:
32
cm-cli.py
32
cm-cli.py
@@ -54,7 +54,7 @@ def check_comfyui_hash():
|
||||
core.comfy_ui_commit_datetime = repo.head.commit.committed_datetime
|
||||
|
||||
|
||||
check_comfyui_hash() # This is a preparation step for manager_core
|
||||
# check_comfyui_hash() # This is a preparation step for manager_core
|
||||
|
||||
|
||||
def read_downgrade_blacklist():
|
||||
@@ -83,6 +83,10 @@ class Ctx:
|
||||
self.mode = 'remote'
|
||||
self.processed_install = set()
|
||||
self.custom_node_map_cache = None
|
||||
self.no_deps = False
|
||||
|
||||
def set_no_deps(self, no_deps):
|
||||
self.no_deps = no_deps
|
||||
|
||||
def set_channel_mode(self, channel, mode):
|
||||
if mode is not None:
|
||||
@@ -202,10 +206,11 @@ class Ctx:
|
||||
cm_ctx = Ctx()
|
||||
|
||||
|
||||
def install_node(node_name, is_all=False, cnt_msg=''):
|
||||
def install_node(node_name, is_all=False, cnt_msg='', install_path=None, no_deps=False):
|
||||
if core.is_valid_url(node_name):
|
||||
# install via urls
|
||||
res = core.gitclone_install([node_name])
|
||||
print(f"Installing {node_name} to {install_path}")
|
||||
res = core.gitclone_install([node_name], install_path=install_path)
|
||||
if not res:
|
||||
print(f"[bold red]ERROR: An error occurred while installing '{node_name}'.[/bold red]")
|
||||
else:
|
||||
@@ -219,7 +224,7 @@ def install_node(node_name, is_all=False, cnt_msg=''):
|
||||
elif os.path.exists(node_path + '.disabled'):
|
||||
enable_node(node_name)
|
||||
else:
|
||||
res = core.gitclone_install(node_item['files'], instant_execution=True, msg_prefix=f"[{cnt_msg}] ")
|
||||
res = core.gitclone_install(node_item['files'], instant_execution=True, msg_prefix=f"[{cnt_msg}] ", install_path=install_path, no_deps=no_deps)
|
||||
if not res:
|
||||
print(f"[bold red]ERROR: An error occurred while installing '{node_name}'.[/bold red]")
|
||||
else:
|
||||
@@ -469,7 +474,7 @@ def auto_save_snapshot():
|
||||
print(f"Current snapshot is saved as `{path}`")
|
||||
|
||||
|
||||
def for_each_nodes(nodes, act, allow_all=True):
|
||||
def for_each_nodes(nodes, act, allow_all=True, install_path=None, no_deps=False):
|
||||
is_all = False
|
||||
if allow_all and 'all' in nodes:
|
||||
is_all = True
|
||||
@@ -481,7 +486,7 @@ def for_each_nodes(nodes, act, allow_all=True):
|
||||
i = 1
|
||||
for x in nodes:
|
||||
try:
|
||||
act(x, is_all=is_all, cnt_msg=f'{i}/{total}')
|
||||
act(x, is_all=is_all, cnt_msg=f'{i}/{total}', install_path=install_path, no_deps=no_deps)
|
||||
except Exception as e:
|
||||
print(f"ERROR: {e}")
|
||||
traceback.print_exc()
|
||||
@@ -513,9 +518,22 @@ def install(
|
||||
None,
|
||||
help="[remote|local|cache]"
|
||||
),
|
||||
install_path: str = typer.Option(
|
||||
None,
|
||||
help="Specify the installation path"
|
||||
),
|
||||
no_deps: Annotated[
|
||||
Optional[bool],
|
||||
typer.Option(
|
||||
"--no-deps",
|
||||
show_default=False,
|
||||
help="Skip installing any Python dependencies",
|
||||
),
|
||||
] = False,
|
||||
):
|
||||
cm_ctx.set_channel_mode(channel, mode)
|
||||
for_each_nodes(nodes, act=install_node)
|
||||
cm_ctx.set_no_deps(no_deps)
|
||||
for_each_nodes(nodes, act=install_node, install_path=install_path, no_deps=no_deps)
|
||||
|
||||
|
||||
@app.command(help="Reinstall custom nodes")
|
||||
|
||||
Reference in New Issue
Block a user