support disable.py/enable.py scripts

This commit is contained in:
Dr.Lt.Data
2023-07-23 13:02:00 +09:00
parent f24b506715
commit 3dcf04e324
5 changed files with 82 additions and 62 deletions

View File

@@ -6,7 +6,7 @@ script_list_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "st
# 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")
print("[ComfyUI-Manager] Starting dependency installation/(de)activation for the extension\n")
executed = set()
# Read each line from the file and convert it to a list using eval
@@ -19,19 +19,18 @@ if os.path.exists(script_list_path):
try:
script = eval(line)
print(f"\n## Install dependency for '{script[0]}'")
print(f"\n## Execute install/(de)activation script for '{script[0]}'")
code = subprocess.run(script[1:], cwd=script[0])
if code.returncode != 0:
print(f"install script failed: {script[0]}")
print(f"install/(de)activation script failed: {script[0]}")
except Exception as e:
print(f"[ERROR] Failed to install: {line} / {e}")
print(f"[ERROR] Failed to execute install/(de)activation script: {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[ComfyUI-Manager] Startup script completed.")
print("#######################################################################\n")