|
|
@ -3,6 +3,28 @@ import shutil |
|
|
|
import folder_paths |
|
|
|
import folder_paths |
|
|
|
import os, sys |
|
|
|
import os, sys |
|
|
|
import subprocess |
|
|
|
import subprocess |
|
|
|
|
|
|
|
import threading |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_stream(stream, prefix): |
|
|
|
|
|
|
|
for line in stream: |
|
|
|
|
|
|
|
print(prefix, line, end="") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_script(cmd, cwd='.'): |
|
|
|
|
|
|
|
process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stdout_thread = threading.Thread(target=handle_stream, args=(process.stdout, "")) |
|
|
|
|
|
|
|
stderr_thread = threading.Thread(target=handle_stream, args=(process.stderr, "[!]")) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stdout_thread.start() |
|
|
|
|
|
|
|
stderr_thread.start() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stdout_thread.join() |
|
|
|
|
|
|
|
stderr_thread.join() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return process.wait() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
import git |
|
|
|
import git |
|
|
@ -12,13 +34,13 @@ except: |
|
|
|
|
|
|
|
|
|
|
|
print(f"## ComfyUI-Manager: installing dependencies") |
|
|
|
print(f"## ComfyUI-Manager: installing dependencies") |
|
|
|
|
|
|
|
|
|
|
|
subprocess.check_call([sys.executable, '-s', '-m', 'pip', 'install', '-r', requirements_path]) |
|
|
|
run_script([sys.executable, '-s', '-m', 'pip', 'install', '-r', requirements_path]) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
import git |
|
|
|
import git |
|
|
|
except: |
|
|
|
except: |
|
|
|
print(f"## [ERROR] ComfyUI-Manager: Attempting to reinstall dependencies using an alternative method.") |
|
|
|
print(f"## [ERROR] ComfyUI-Manager: Attempting to reinstall dependencies using an alternative method.") |
|
|
|
subprocess.check_call([sys.executable, '-s', '-m', 'pip', 'install', '--user', '-r', requirements_path]) |
|
|
|
run_script([sys.executable, '-s', '-m', 'pip', 'install', '--user', '-r', requirements_path]) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
import git |
|
|
|
import git |
|
|
@ -33,7 +55,7 @@ sys.path.append('../..') |
|
|
|
from torchvision.datasets.utils import download_url |
|
|
|
from torchvision.datasets.utils import download_url |
|
|
|
|
|
|
|
|
|
|
|
# ensure .js |
|
|
|
# ensure .js |
|
|
|
print("### Loading: ComfyUI-Manager (V0.21.3)") |
|
|
|
print("### Loading: ComfyUI-Manager (V0.21.4)") |
|
|
|
|
|
|
|
|
|
|
|
comfy_ui_required_revision = 1240 |
|
|
|
comfy_ui_required_revision = 1240 |
|
|
|
comfy_ui_revision = "Unknown" |
|
|
|
comfy_ui_revision = "Unknown" |
|
|
@ -137,7 +159,7 @@ def try_install_script(url, repo_path, install_cmd): |
|
|
|
return True |
|
|
|
return True |
|
|
|
else: |
|
|
|
else: |
|
|
|
print(f"\n## ComfyUI-Manager: EXECUTE => {install_cmd}") |
|
|
|
print(f"\n## ComfyUI-Manager: EXECUTE => {install_cmd}") |
|
|
|
code = subprocess.run(install_cmd, cwd=repo_path) |
|
|
|
code = run_script(install_cmd, cwd=repo_path) |
|
|
|
|
|
|
|
|
|
|
|
if platform.system() == "Windows": |
|
|
|
if platform.system() == "Windows": |
|
|
|
try: |
|
|
|
try: |
|
|
@ -149,7 +171,7 @@ def try_install_script(url, repo_path, install_cmd): |
|
|
|
except: |
|
|
|
except: |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
if code.returncode != 0: |
|
|
|
if code != 0: |
|
|
|
print(f"install script failed: {url}") |
|
|
|
print(f"install script failed: {url}") |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
@ -647,8 +669,7 @@ def gitclone_install(files): |
|
|
|
|
|
|
|
|
|
|
|
# Clone the repository from the remote URL |
|
|
|
# Clone the repository from the remote URL |
|
|
|
if platform.system() == 'Windows': |
|
|
|
if platform.system() == 'Windows': |
|
|
|
process = subprocess.Popen([sys.executable, git_script_path, "--clone", custom_nodes_path, url]) |
|
|
|
run_script([sys.executable, git_script_path, "--clone", custom_nodes_path, url]) |
|
|
|
process.wait() |
|
|
|
|
|
|
|
else: |
|
|
|
else: |
|
|
|
repo = git.Repo.clone_from(url, repo_path, recursive=True) |
|
|
|
repo = git.Repo.clone_from(url, repo_path, recursive=True) |
|
|
|
repo.git.clear_cache() |
|
|
|
repo.git.clear_cache() |
|
|
@ -678,7 +699,7 @@ def rmtree(path): |
|
|
|
retry_count -= 1 |
|
|
|
retry_count -= 1 |
|
|
|
|
|
|
|
|
|
|
|
if platform.system() == "Windows": |
|
|
|
if platform.system() == "Windows": |
|
|
|
subprocess.check_call(['attrib', '-R', path + '\\*', '/S']) |
|
|
|
run_script(['attrib', '-R', path + '\\*', '/S']) |
|
|
|
shutil.rmtree(path) |
|
|
|
shutil.rmtree(path) |
|
|
|
|
|
|
|
|
|
|
|
return True |
|
|
|
return True |
|
|
@ -712,14 +733,14 @@ def gitclone_uninstall(files): |
|
|
|
disable_script_path = os.path.join(dir_path, "disable.py") |
|
|
|
disable_script_path = os.path.join(dir_path, "disable.py") |
|
|
|
if os.path.exists(install_script_path): |
|
|
|
if os.path.exists(install_script_path): |
|
|
|
uninstall_cmd = [sys.executable, "uninstall.py"] |
|
|
|
uninstall_cmd = [sys.executable, "uninstall.py"] |
|
|
|
code = subprocess.run(uninstall_cmd, cwd=dir_path) |
|
|
|
code = run_script(uninstall_cmd, cwd=dir_path) |
|
|
|
|
|
|
|
|
|
|
|
if code.returncode != 0: |
|
|
|
if code != 0: |
|
|
|
print(f"An error occurred during the execution of the uninstall.py script. Only the '{dir_path}' will be deleted.") |
|
|
|
print(f"An error occurred during the execution of the uninstall.py script. Only the '{dir_path}' will be deleted.") |
|
|
|
elif os.path.exists(disable_script_path): |
|
|
|
elif os.path.exists(disable_script_path): |
|
|
|
disable_script = [sys.executable, "disable.py"] |
|
|
|
disable_script = [sys.executable, "disable.py"] |
|
|
|
code = subprocess.run(disable_script, cwd=dir_path) |
|
|
|
code = run_script(disable_script, cwd=dir_path) |
|
|
|
if code.returncode != 0: |
|
|
|
if code != 0: |
|
|
|
print(f"An error occurred during the execution of the disable.py script. Only the '{dir_path}' will be deleted.") |
|
|
|
print(f"An error occurred during the execution of the disable.py script. Only the '{dir_path}' will be deleted.") |
|
|
|
|
|
|
|
|
|
|
|
if os.path.exists(dir_path): |
|
|
|
if os.path.exists(dir_path): |
|
|
|