remove init.py code
This commit is contained in:
+4
-62
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user