From d03c3b68c4e9517297bbb15ee8e50d5a42ecf1a2 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Fri, 17 May 2024 21:24:46 -0400 Subject: [PATCH] remove init.py code --- __init__.py | 66 ++++------------------------------------------------- 1 file changed, 4 insertions(+), 62 deletions(-) diff --git a/__init__.py b/__init__.py index a967944..91dc545 100644 --- a/__init__.py +++ b/__init__.py @@ -1,66 +1,8 @@ -import __main__ - -import os -import subprocess -import threading -import sys -import locale -import traceback - -def handle_stream(stream, prefix): - stream.reconfigure(encoding=locale.getpreferredencoding(), errors='replace') - for msg in stream: - if prefix == '[!]' and ('it/s]' in msg or 's/it]' in msg) and ('%|' in msg or 'it [' in msg): - if msg.startswith('100%'): - print('\r' + msg, end="", file=sys.stderr), - else: - print('\r' + msg[:-1], end="", file=sys.stderr), - else: - if prefix == '[!]': - print(prefix, msg, end="", file=sys.stderr) - else: - print(prefix, msg, end="") - -def run_script(cmd, cwd='.'): - if len(cmd) > 0 and cmd[0].startswith("#"): - print(f"[ComfyUI-LayerDivider] Unexpected behavior: `{cmd}`") - return 0 - - 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: from .layer_divider_node import NODE_CLASS_MAPPINGS except: - my_path = os.path.dirname(__file__) - requirements_path = os.path.join(my_path, "requirements.txt") + print(f"## ComfyUI LayerDivider - Miss Dependencies.") + print( + f"## ComfyUI LayerDivider - Please stop ComfyUI first, then run install_windows_portable_win_py311_cu121.bat") - print(f"## LayerDivider: installing dependencies") - - run_script([sys.executable, '-s', '-m', 'pip', 'install', '-r', requirements_path]) - - try: - from .layer_divider_node import NODE_CLASS_MAPPINGS - except: - print(f"## [ERROR] LayerDivider: Attempting to reinstall dependencies using an alternative method.") - run_script([sys.executable, '-s', '-m', 'pip', 'install', '--user', '-r', requirements_path]) - - try: - from .nodes import NODE_CLASS_MAPPINGS - except: - print(f"## [ERROR] LayerDivider: Failed to install package in the correct Python environment.") - traceback.print_exc() - - print(f"## LayerDivider: installing dependencies done.") - -__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] +__all__ = ['NODE_CLASS_MAPPINGS']