mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-17 02:12:58 +08:00
fixed: crash related to deleted CNR node after installed
modified: convert cm-cli.sh to cm-cli command
This commit is contained in:
parent
6233fabe02
commit
9d2034bd4f
@ -1,6 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
from comfy.cli_args import args
|
|
||||||
|
|
||||||
def prestartup():
|
def prestartup():
|
||||||
from . import prestartup_script # noqa: F401
|
from . import prestartup_script # noqa: F401
|
||||||
@ -8,6 +7,8 @@ def prestartup():
|
|||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
|
from comfy.cli_args import args
|
||||||
|
|
||||||
logging.info('[START] ComfyUI-Manager')
|
logging.info('[START] ComfyUI-Manager')
|
||||||
from .common import cm_global # noqa: F401
|
from .common import cm_global # noqa: F401
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ def should_be_disabled(fullpath:str) -> bool:
|
|||||||
1. Disables the legacy ComfyUI-Manager.
|
1. Disables the legacy ComfyUI-Manager.
|
||||||
2. The blocklist can be expanded later based on policies.
|
2. The blocklist can be expanded later based on policies.
|
||||||
"""
|
"""
|
||||||
|
from comfy.cli_args import args
|
||||||
|
|
||||||
if not args.disable_manager:
|
if not args.disable_manager:
|
||||||
# In cases where installation is done via a zip archive, the directory name may not be comfyui-manager, and it may not contain a git repository.
|
# In cases where installation is done via a zip archive, the directory name may not be comfyui-manager, and it may not contain a git repository.
|
||||||
|
|||||||
0
comfyui_manager/cm_cli/__init__.py
Normal file
0
comfyui_manager/cm_cli/__init__.py
Normal file
@ -15,7 +15,7 @@ import git
|
|||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
|
|
||||||
from .common import manager_util
|
from ..common import manager_util
|
||||||
|
|
||||||
# read env vars
|
# read env vars
|
||||||
# COMFYUI_FOLDERS_BASE_PATH is not required in cm-cli.py
|
# COMFYUI_FOLDERS_BASE_PATH is not required in cm-cli.py
|
||||||
@ -35,11 +35,11 @@ if not os.path.exists(os.path.join(comfy_path, 'folder_paths.py')):
|
|||||||
|
|
||||||
|
|
||||||
import utils.extra_config
|
import utils.extra_config
|
||||||
from .common import cm_global
|
from ..common import cm_global
|
||||||
from .glob import manager_core as core
|
from ..legacy import manager_core as core
|
||||||
from .common import context
|
from ..common import context
|
||||||
from .glob.manager_core import unified_manager
|
from ..legacy.manager_core import unified_manager
|
||||||
from .common import cnr_utils
|
from ..common import cnr_utils
|
||||||
|
|
||||||
comfyui_manager_path = os.path.abspath(os.path.dirname(__file__))
|
comfyui_manager_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class Ctx:
|
|||||||
self.no_deps = False
|
self.no_deps = False
|
||||||
self.mode = 'cache'
|
self.mode = 'cache'
|
||||||
self.user_directory = None
|
self.user_directory = None
|
||||||
self.custom_nodes_paths = [os.path.join(core.comfy_base_path, 'custom_nodes')]
|
self.custom_nodes_paths = [os.path.join(context.comfy_base_path, 'custom_nodes')]
|
||||||
self.manager_files_directory = os.path.dirname(__file__)
|
self.manager_files_directory = os.path.dirname(__file__)
|
||||||
|
|
||||||
if Ctx.folder_paths is None:
|
if Ctx.folder_paths is None:
|
||||||
@ -444,10 +444,13 @@ def show_list(kind, simple=False):
|
|||||||
flag = kind in ['all', 'cnr', 'installed', 'enabled']
|
flag = kind in ['all', 'cnr', 'installed', 'enabled']
|
||||||
for k, v in unified_manager.active_nodes.items():
|
for k, v in unified_manager.active_nodes.items():
|
||||||
if flag:
|
if flag:
|
||||||
cnr = unified_manager.cnr_map[k]
|
cnr = unified_manager.cnr_map.get(k)
|
||||||
|
if cnr:
|
||||||
processed[k] = "[ ENABLED ] ", cnr['name'], k, cnr['publisher']['name'], v[0]
|
processed[k] = "[ ENABLED ] ", cnr['name'], k, cnr['publisher']['name'], v[0]
|
||||||
else:
|
else:
|
||||||
processed[k] = None
|
processed[k] = None
|
||||||
|
else:
|
||||||
|
processed[k] = None
|
||||||
|
|
||||||
if flag and kind != 'cnr':
|
if flag and kind != 'cnr':
|
||||||
for k, v in unified_manager.unknown_active_nodes.items():
|
for k, v in unified_manager.unknown_active_nodes.items():
|
||||||
@ -465,20 +468,26 @@ def show_list(kind, simple=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if flag:
|
if flag:
|
||||||
cnr = unified_manager.cnr_map[k]
|
cnr = unified_manager.cnr_map.get(k) # NOTE: can this be None if removed from CNR after installed
|
||||||
|
if cnr:
|
||||||
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], ", ".join(list(v.keys()))
|
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], ", ".join(list(v.keys()))
|
||||||
else:
|
else:
|
||||||
processed[k] = None
|
processed[k] = None
|
||||||
|
else:
|
||||||
|
processed[k] = None
|
||||||
|
|
||||||
for k, v in unified_manager.nightly_inactive_nodes.items():
|
for k, v in unified_manager.nightly_inactive_nodes.items():
|
||||||
if k in processed:
|
if k in processed:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if flag:
|
if flag:
|
||||||
cnr = unified_manager.cnr_map[k]
|
cnr = unified_manager.cnr_map.get(k)
|
||||||
|
if cnr:
|
||||||
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], 'nightly'
|
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], 'nightly'
|
||||||
else:
|
else:
|
||||||
processed[k] = None
|
processed[k] = None
|
||||||
|
else:
|
||||||
|
processed[k] = None
|
||||||
|
|
||||||
if flag and kind != 'cnr':
|
if flag and kind != 'cnr':
|
||||||
for k, v in unified_manager.unknown_inactive_nodes.items():
|
for k, v in unified_manager.unknown_inactive_nodes.items():
|
||||||
@ -496,11 +505,14 @@ def show_list(kind, simple=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if flag:
|
if flag:
|
||||||
cnr = unified_manager.cnr_map[k]
|
cnr = unified_manager.cnr_map.get(k)
|
||||||
|
if cnr:
|
||||||
ver_spec = v['latest_version']['version'] if 'latest_version' in v else '0.0.0'
|
ver_spec = v['latest_version']['version'] if 'latest_version' in v else '0.0.0'
|
||||||
processed[k] = "[ NOT INSTALLED ] ", cnr['name'], k, cnr['publisher']['name'], ver_spec
|
processed[k] = "[ NOT INSTALLED ] ", cnr['name'], k, cnr['publisher']['name'], ver_spec
|
||||||
else:
|
else:
|
||||||
processed[k] = None
|
processed[k] = None
|
||||||
|
else:
|
||||||
|
processed[k] = None
|
||||||
|
|
||||||
if flag and kind != 'cnr':
|
if flag and kind != 'cnr':
|
||||||
for x in not_installed_unknown_nodes:
|
for x in not_installed_unknown_nodes:
|
||||||
@ -1286,6 +1298,10 @@ def export_custom_node_ids(
|
|||||||
print(f"{x['id']}@unknown", file=output_file)
|
print(f"{x['id']}@unknown", file=output_file)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||||
sys.exit(app())
|
sys.exit(app())
|
||||||
@ -87,9 +87,6 @@ manager_pip_blacklist_path = os.path.join(manager_files_path, "pip_blacklist.lis
|
|||||||
restore_snapshot_path = os.path.join(manager_files_path, "startup-scripts", "restore-snapshot.json")
|
restore_snapshot_path = os.path.join(manager_files_path, "startup-scripts", "restore-snapshot.json")
|
||||||
manager_config_path = os.path.join(manager_files_path, 'config.ini')
|
manager_config_path = os.path.join(manager_files_path, 'config.ini')
|
||||||
|
|
||||||
cm_cli_path = os.path.join(comfyui_manager_path, "cm-cli.py")
|
|
||||||
|
|
||||||
|
|
||||||
default_conf = {}
|
default_conf = {}
|
||||||
|
|
||||||
def read_config():
|
def read_config():
|
||||||
@ -563,7 +560,10 @@ if os.path.exists(restore_snapshot_path):
|
|||||||
if 'COMFYUI_FOLDERS_BASE_PATH' not in new_env:
|
if 'COMFYUI_FOLDERS_BASE_PATH' not in new_env:
|
||||||
new_env["COMFYUI_FOLDERS_BASE_PATH"] = comfy_path
|
new_env["COMFYUI_FOLDERS_BASE_PATH"] = comfy_path
|
||||||
|
|
||||||
cmd_str = [sys.executable, cm_cli_path, 'restore-snapshot', restore_snapshot_path]
|
if 'COMFYUI_PATH' not in new_env:
|
||||||
|
new_env['COMFYUI_PATH'] = os.path.dirname(folder_paths.__file__)
|
||||||
|
|
||||||
|
cmd_str = [sys.executable, '-m', 'comfyui_manager.cm_cli', 'restore-snapshot', restore_snapshot_path]
|
||||||
exit_code = process_wrap(cmd_str, custom_nodes_base_path, handler=msg_capture, env=new_env)
|
exit_code = process_wrap(cmd_str, custom_nodes_base_path, handler=msg_capture, env=new_env)
|
||||||
|
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
|
|||||||
@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-manager"
|
name = "comfyui-manager"
|
||||||
license = { text = "GPL-3.0-only" }
|
license = { text = "GPL-3.0-only" }
|
||||||
version = "4.0.0-beta.2"
|
version = "4.0.0-beta.3"
|
||||||
requires-python = ">= 3.9"
|
requires-python = ">= 3.9"
|
||||||
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -48,6 +48,9 @@ Repository = "https://github.com/ltdrdata/ComfyUI-Manager"
|
|||||||
where = ["."]
|
where = ["."]
|
||||||
include = ["comfyui_manager*"]
|
include = ["comfyui_manager*"]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
cm-cli = "comfyui_manager.cm_cli.__main__:main"
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
target-version = "py39"
|
target-version = "py39"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user