From 17b81e1da45bc1321640a3bbc131f203af89c95c Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Tue, 14 Nov 2023 19:10:55 +0900 Subject: [PATCH] fix: subpack install --- __init__.py | 18 ++++++++++++++---- install.py | 2 +- modules/impact/config.py | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index f77094b..7792461 100644 --- a/__init__.py +++ b/__init__.py @@ -9,6 +9,7 @@ import shutil import folder_paths import os import sys +import traceback comfy_path = os.path.dirname(folder_paths.__file__) impact_path = os.path.join(os.path.dirname(__file__)) @@ -33,8 +34,12 @@ def do_install(): # ensure dependency +if not os.path.exists(os.path.join(subpack_path, ".git")) and os.path.exists(subpack_path): + print(f"### CompfyUI-Impact-Pack: corrupted subpack detected.") + shutil.rmtree(subpack_path) + if impact.config.get_config()['dependency_version'] < impact.config.dependency_version or not os.path.exists(subpack_path): - print(f"## ComfyUI-Impact-Pack: Updating dependencies") + print(f"### ComfyUI-Impact-Pack: Updating dependencies [{impact.config.get_config()['dependency_version']} -> {impact.config.dependency_version}]") do_install() sys.path.append(subpack_path) @@ -402,9 +407,14 @@ try: NODE_CLASS_MAPPINGS.update(impact.subpack_nodes.NODE_CLASS_MAPPINGS) NODE_DISPLAY_NAME_MAPPINGS.update(impact.subpack_nodes.NODE_DISPLAY_NAME_MAPPINGS) - -except: - pass +except Exception as e: + print("### ComfyUI-Impact-Pack: (IMPORT FAILED) Subpack\n") + print(" The module at the `custom_nodes/ComfyUI-Impact-Pack/impact_subpack` path appears to be incomplete.") + print(" Recommended to delete the path and restart ComfyUI.") + print(" If the issue persists, please report it to https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues.") + print("\n---------------------------------") + traceback.print_exc() + print("---------------------------------\n") WEB_DIRECTORY = "js" __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] diff --git a/install.py b/install.py index 1c29d43..d79cf99 100644 --- a/install.py +++ b/install.py @@ -12,7 +12,7 @@ impact_path = os.path.join(os.path.dirname(__file__), "modules") old_subpack_path = os.path.join(os.path.dirname(__file__), "subpack") subpack_path = os.path.join(os.path.dirname(__file__), "impact_subpack") subpack_repo = "https://github.com/ltdrdata/ComfyUI-Impact-Subpack" -comfy_path = os.path.join(os.path.dirname(__file__), '..', '..') +comfy_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) sys.path.append(impact_path) diff --git a/modules/impact/config.py b/modules/impact/config.py index 0e2071e..5332785 100644 --- a/modules/impact/config.py +++ b/modules/impact/config.py @@ -2,7 +2,7 @@ import configparser import os -version = "V4.30.3" +version = "V4.30.4" dependency_version = 17