Files
dmarx-ComfyUI-Keyframed/__init__.py
T
2023-12-04 20:27:12 -08:00

40 lines
1.3 KiB
Python

import os
import subprocess
import importlib.util
import sys
# scavenged install sequence from https://github.com/FizzleDorf/ComfyUI_FizzNodes/blob/main/__init__.py
def is_installed(package, package_overwrite=None):
try:
spec = importlib.util.find_spec(package)
except ModuleNotFoundError:
pass
package = package_overwrite or package
python = sys.executable
if spec is None:
print(f"Installing {package}...")
command = f'"{python}" -m pip install {package}'
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=os.environ)
if result.returncode != 0:
print(f"Couldn't install\nCommand: {command}\nError code: {result.returncode}")
# to do: read from requirements.txt
is_installed("keyframed")
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
print(os.environ.get('COMFYUI_DEBUG_MODE'))
from .debug import NODE_CLASS_MAPPINGS as ncm0, NODE_DISPLAY_NAME_MAPPINGS as ndnm0
# there's probably a cleaner, more-dummy-proof way to do this.
# feels like an accident waiting to happen. low risk though.
NODE_CLASS_MAPPINGS.update(ncm0)
NODE_DISPLAY_NAME_MAPPINGS.update(ndnm0)
__all__ =["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]