Skip to content

Commit

Permalink
Merge pull request yondonfu#89 from ryanontheinside:feat/single-pytho…
Browse files Browse the repository at this point in the history
…n-environment

improvement: single python environment
  • Loading branch information
eliteprox authored Feb 24, 2025
2 parents 81a1be6 + 0e7f8dd commit 9dbc9a1
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,34 @@
import subprocess
import argparse
import logging
import pathlib

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)

def ensure_init_files(workspace: str):
"""Create __init__.py files in comfy/ and comfy_extras/ directories if they don't exist"""
base_dirs = ['comfy', 'comfy_extras']
for base_dir in base_dirs:
base_path = os.path.join(workspace, base_dir)
if not os.path.exists(base_path):
continue

# Create __init__.py in the root of base_dir first
root_init = os.path.join(base_path, "__init__.py")
if not os.path.exists(root_init):
logger.info(f"Creating {root_init}")
with open(root_init, 'w') as f:
f.write("")

# Then walk subdirectories
for root, dirs, files in os.walk(base_path):
init_path = os.path.join(root, "__init__.py")
if not os.path.exists(init_path):
logger.info(f"Creating {init_path}")
with open(init_path, 'w') as f:
f.write("")

def install_custom_node_req(workspace: str):
custom_nodes_path = os.path.join(workspace, "custom_nodes")
for folder in os.listdir(custom_nodes_path):
Expand All @@ -26,4 +50,8 @@ def install_custom_node_req(workspace: str):

logger.info("Installing custom node requirements...")
install_custom_node_req(args.workspace)
logger.info("Custom node requirements installed successfully.")

logger.info("Ensuring __init__.py files exist in ComfyUI directories...")
ensure_init_files(args.workspace)

logger.info("Installation completed successfully.")

0 comments on commit 9dbc9a1

Please sign in to comment.