|
|
@ -14,7 +14,7 @@ import concurrent |
|
|
|
import ssl |
|
|
|
import ssl |
|
|
|
from urllib.parse import urlparse |
|
|
|
from urllib.parse import urlparse |
|
|
|
|
|
|
|
|
|
|
|
version = "V1.0.2" |
|
|
|
version = "V1.1" |
|
|
|
print(f"### Loading: ComfyUI-Manager ({version})") |
|
|
|
print(f"### Loading: ComfyUI-Manager ({version})") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,6 +34,10 @@ def handle_stream(stream, prefix): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_script(cmd, cwd='.'): |
|
|
|
def run_script(cmd, cwd='.'): |
|
|
|
|
|
|
|
if len(cmd) > 0 and cmd[0].startswith("#"): |
|
|
|
|
|
|
|
print(f"[ComfyUI-Manager] Unexpected behavior: `{cmd}`") |
|
|
|
|
|
|
|
return 0 |
|
|
|
|
|
|
|
|
|
|
|
process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1) |
|
|
|
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, "")) |
|
|
|
stdout_thread = threading.Thread(target=handle_stream, args=(process.stdout, "")) |
|
|
@ -233,6 +237,8 @@ def try_install_script(url, repo_path, install_cmd): |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
if code != 0: |
|
|
|
if code != 0: |
|
|
|
|
|
|
|
if url is None: |
|
|
|
|
|
|
|
url = os.path.dirname(repo_path) |
|
|
|
print(f"install script failed: {url}") |
|
|
|
print(f"install script failed: {url}") |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
@ -325,7 +331,9 @@ def git_repo_has_updates(path, do_fetch=False, do_update=False): |
|
|
|
raise ValueError('Not a git repository') |
|
|
|
raise ValueError('Not a git repository') |
|
|
|
|
|
|
|
|
|
|
|
if platform.system() == "Windows": |
|
|
|
if platform.system() == "Windows": |
|
|
|
return __win_check_git_update(path, do_fetch, do_update) |
|
|
|
res = __win_check_git_update(path, do_fetch, do_update) |
|
|
|
|
|
|
|
execute_install_script(None, path, lazy_mode=True) |
|
|
|
|
|
|
|
return res |
|
|
|
else: |
|
|
|
else: |
|
|
|
# Fetch the latest commits from the remote repository |
|
|
|
# Fetch the latest commits from the remote repository |
|
|
|
repo = git.Repo(path) |
|
|
|
repo = git.Repo(path) |
|
|
@ -349,6 +357,7 @@ def git_repo_has_updates(path, do_fetch=False, do_update=False): |
|
|
|
new_commit_hash = repo.head.commit.hexsha |
|
|
|
new_commit_hash = repo.head.commit.hexsha |
|
|
|
|
|
|
|
|
|
|
|
if commit_hash != new_commit_hash: |
|
|
|
if commit_hash != new_commit_hash: |
|
|
|
|
|
|
|
execute_install_script(None, path) |
|
|
|
print(f"\x1b[2K\rUpdated: {path}") |
|
|
|
print(f"\x1b[2K\rUpdated: {path}") |
|
|
|
return True |
|
|
|
return True |
|
|
|
else: |
|
|
|
else: |
|
|
@ -958,10 +967,14 @@ def copy_set_active(files, is_disable, js_path_name='.'): |
|
|
|
return True |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def execute_install_script(url, repo_path): |
|
|
|
def execute_install_script(url, repo_path, lazy_mode=False): |
|
|
|
install_script_path = os.path.join(repo_path, "install.py") |
|
|
|
install_script_path = os.path.join(repo_path, "install.py") |
|
|
|
requirements_path = os.path.join(repo_path, "requirements.txt") |
|
|
|
requirements_path = os.path.join(repo_path, "requirements.txt") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if lazy_mode: |
|
|
|
|
|
|
|
install_cmd = ["#LAZY-INSTALL-SCRIPT", sys.executable] |
|
|
|
|
|
|
|
try_install_script(url, repo_path, install_cmd) |
|
|
|
|
|
|
|
else: |
|
|
|
if os.path.exists(requirements_path): |
|
|
|
if os.path.exists(requirements_path): |
|
|
|
print("Install: pip packages") |
|
|
|
print("Install: pip packages") |
|
|
|
with open(requirements_path, "r") as requirements_file: |
|
|
|
with open(requirements_path, "r") as requirements_file: |
|
|
@ -1163,7 +1176,7 @@ def gitclone_update(files): |
|
|
|
repo_path = os.path.join(custom_nodes_path, repo_name) |
|
|
|
repo_path = os.path.join(custom_nodes_path, repo_name) |
|
|
|
git_pull(repo_path) |
|
|
|
git_pull(repo_path) |
|
|
|
|
|
|
|
|
|
|
|
if not execute_install_script(url, repo_path): |
|
|
|
if not execute_install_script(url, repo_path, lazy_mode=True): |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|