Browse Source

feat: cm-cli - restore-dependencies

fix: cm-cli - path fix
pull/591/head
Dr.Lt.Data 7 months ago
parent
commit
b088dcbd9e
  1. 48
      cm-cli.py
  2. 2
      glob/manager_core.py

48
cm-cli.py

@ -6,7 +6,8 @@ import json
import asyncio import asyncio
import subprocess import subprocess
sys.path.append("./glob") sys.path.append(os.path.dirname(__file__))
sys.path.append(os.path.join(os.path.dirname(__file__), "glob"))
import manager_core as core import manager_core as core
import cm_global import cm_global
import git import git
@ -14,6 +15,21 @@ import git
print(f"\n-= ComfyUI-Manager CLI ({core.version_str}) =-\n") print(f"\n-= ComfyUI-Manager CLI ({core.version_str}) =-\n")
if not (len(sys.argv) == 2 and sys.argv[1] in ['save-snapshot', 'restore-dependencies', 'clear']) and len(sys.argv) < 3:
print(f"\npython cm-cli.py [OPTIONS]\n\n"
f"OPTIONS:\n"
f" [install|uninstall|update|disable|enable|fix] node_name ... ?[--channel <channel name>] ?[--mode [remote|local|cache]]\n"
f" [update|disable|enable|fix] all ?[--channel <channel name>] ?[--mode [remote|local|cache]]\n"
f" [simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel <channel name>] ?[--mode [remote|local|cache]]\n"
f" save-snapshot\n"
f" restore-snapshot <snapshot>\n"
f" cli-only-mode [enable|disable]\n"
f" restore-dependencies\n"
f" clear\n")
exit(-1)
comfyui_manager_path = os.path.dirname(__file__) comfyui_manager_path = os.path.dirname(__file__)
comfy_path = os.environ.get('COMFYUI_PATH') comfy_path = os.environ.get('COMFYUI_PATH')
@ -75,6 +91,19 @@ def post_install(url):
print(f"ERROR: Restoring '{url}' is failed.") print(f"ERROR: Restoring '{url}' is failed.")
def restore_dependencies():
node_paths = [os.path.join(custom_nodes_path, name) for name in os.listdir(custom_nodes_path)
if os.path.isdir(os.path.join(custom_nodes_path, name)) and not name.endswith('.disabled')]
total = len(node_paths)
i = 1
for x in node_paths:
print(f"----------------------------------------------------------------------------------------------------")
print(f"Restoring [{i}/{total}]: {x}")
post_install(x)
i += 1
def restore_snapshot(snapshot_name): def restore_snapshot(snapshot_name):
global processed_install global processed_install
@ -168,21 +197,6 @@ def read_downgrade_blacklist():
read_downgrade_blacklist() read_downgrade_blacklist()
if not (len(sys.argv) == 2 and sys.argv[1] == 'save-snapshot') and len(sys.argv) < 3:
print(f"\npython cm-cli.py [OPTIONS]\n\n"
f"OPTIONS:\n"
f" [install|uninstall|update|disable|enable|fix] node_name ... ?[--channel <channel name>] ?[--mode [remote|local|cache]]\n"
f" [update|disable|enable|fix] all ?[--channel <channel name>] ?[--mode [remote|local|cache]]\n"
f" [simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel <channel name>] ?[--mode [remote|local|cache]]\n"
f" save-snapshot\n"
f" restore-snapshot <snapshot>\n"
f" cli-only-mode [enable|disable]\n"
f" restore-dependencies -- NOT YET\n"
f" clear\n")
exit(-1)
channel = 'default' channel = 'default'
mode = 'remote' mode = 'remote'
nodes = set() nodes = set()
@ -458,7 +472,7 @@ elif op == 'restore-snapshot':
restore_snapshot(sys.argv[2]) restore_snapshot(sys.argv[2])
elif op == 'restore-dependencies': elif op == 'restore-dependencies':
print(f"TODO: NOT YET IMPLEMENTED") restore_dependencies()
elif op == 'clear': elif op == 'clear':
cancel() cancel()

2
glob/manager_core.py

@ -21,7 +21,7 @@ sys.path.append(glob_path)
import cm_global import cm_global
from manager_util import * from manager_util import *
version = [2, 20, 2] version = [2, 21, 1]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
comfyui_manager_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) comfyui_manager_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

Loading…
Cancel
Save