You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.3 KiB
38 lines
1.3 KiB
1 year ago
|
import os
|
||
|
import subprocess
|
||
|
|
||
|
script_list_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "startup-scripts", "install-scripts.txt")
|
||
|
|
||
|
# Check if script_list_path exists
|
||
|
if os.path.exists(script_list_path):
|
||
|
print("\n#######################################################################")
|
||
|
print("[ComfyUI-Manager] Starting dependency installation for the extension\n")
|
||
|
|
||
|
executed = set()
|
||
|
# Read each line from the file and convert it to a list using eval
|
||
|
with open(script_list_path, 'r') as file:
|
||
|
for line in file:
|
||
|
if line in executed:
|
||
|
continue
|
||
|
|
||
|
executed.add(line)
|
||
|
|
||
|
try:
|
||
|
script = eval(line)
|
||
|
print(f"\n## Install dependency for '{script[0]}'")
|
||
|
code = subprocess.run(script[1:], cwd=script[0])
|
||
|
|
||
|
if code.returncode != 0:
|
||
|
print(f"install script failed: {script[0]}")
|
||
|
except Exception as e:
|
||
|
print(f"[ERROR] Failed to install: {line} / {e}")
|
||
|
|
||
|
|
||
|
# Remove the script_list_path file
|
||
|
if os.path.exists(script_list_path):
|
||
|
os.remove(script_list_path)
|
||
|
|
||
|
print("\n[ComfyUI-Manager] Dependency installation completed.")
|
||
|
print("#######################################################################\n")
|
||
|
|