Delete all_nodes.py
Browse files- all_nodes.py +0 -118
all_nodes.py
DELETED
|
@@ -1,118 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import subprocess
|
| 3 |
-
|
| 4 |
-
def colored(text, color):
|
| 5 |
-
"""
|
| 6 |
-
Функция для вывода цветного текста в консоль.
|
| 7 |
-
"""
|
| 8 |
-
colors = {
|
| 9 |
-
'red': '\033[91m',
|
| 10 |
-
'green': '\033[92m',
|
| 11 |
-
'yellow': '\033[93m',
|
| 12 |
-
'blue': '\033[94m',
|
| 13 |
-
'magenta': '\033[95m',
|
| 14 |
-
'cyan': '\033[96m',
|
| 15 |
-
'white': '\033[97m',
|
| 16 |
-
}
|
| 17 |
-
return colors.get(color, '') + text + '\033[0m'
|
| 18 |
-
|
| 19 |
-
# Путь к папке ComfyUI (относительный путь)
|
| 20 |
-
comfyui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "ComfyUI"))
|
| 21 |
-
|
| 22 |
-
# Путь к папке python_embeded (относительный путь)
|
| 23 |
-
python_embeded_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "python_embeded"))
|
| 24 |
-
|
| 25 |
-
# Путь к папке с git (относительный путь)
|
| 26 |
-
# git_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "git", "bin"))
|
| 27 |
-
git_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "git"))
|
| 28 |
-
git_bin_path = os.path.join(git_path, "bin")
|
| 29 |
-
git_libexec_path = os.path.join(git_path, "libexec")
|
| 30 |
-
|
| 31 |
-
# Обновление переменной PATH
|
| 32 |
-
os.environ['PATH'] = f"{git_bin_path};{git_libexec_path};{os.environ['PATH']}"
|
| 33 |
-
|
| 34 |
-
# Словарь с вариантами установки и их репозиториями
|
| 35 |
-
install_options = {
|
| 36 |
-
"Базовые узлы": [
|
| 37 |
-
"https://github.com/ltdrdata/ComfyUI-Manager",
|
| 38 |
-
"https://github.com/crystian/ComfyUI-Crystools"
|
| 39 |
-
],
|
| 40 |
-
"Расширенные узлы": [
|
| 41 |
-
"https://github.com/11cafe/comfyui-workspace-manager",
|
| 42 |
-
"https://github.com/hayden-fr/ComfyUI-Model-Manager",
|
| 43 |
-
"https://github.com/talesofai/comfyui-browser"
|
| 44 |
-
],
|
| 45 |
-
"Все узлы": [
|
| 46 |
-
"https://github.com/comfyui/ComfyUI-Nodes",
|
| 47 |
-
"https://github.com/AUTOMATIC1111/stable-diffusion-webui",
|
| 48 |
-
"https://github.com/your_username/your_custom_node_repo",
|
| 49 |
-
"https://github.com/another_username/another_custom_node_repo",
|
| 50 |
-
# Добавьте сюда ссылки на другие репозитории
|
| 51 |
-
],
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
# Проверка наличия папки с custom_nodes
|
| 55 |
-
custom_nodes_path = os.path.join(comfyui_path, "custom_nodes")
|
| 56 |
-
if not os.path.exists(custom_nodes_path):
|
| 57 |
-
os.makedirs(custom_nodes_path)
|
| 58 |
-
|
| 59 |
-
# Меню выбора варианта установки
|
| 60 |
-
while True:
|
| 61 |
-
print("Выберите вариант установки:")
|
| 62 |
-
for i, option in enumerate(install_options.keys()):
|
| 63 |
-
print(f"{i+1}. {option}")
|
| 64 |
-
choice = input("Введите номер варианта: ")
|
| 65 |
-
|
| 66 |
-
# Проверка ввода
|
| 67 |
-
try:
|
| 68 |
-
choice = int(choice)
|
| 69 |
-
if 1 <= choice <= len(install_options):
|
| 70 |
-
break
|
| 71 |
-
else:
|
| 72 |
-
print("Неверный номер варианта. Пожалуйста, введите число от 1 до", len(install_options))
|
| 73 |
-
except ValueError:
|
| 74 |
-
print("Неверный ввод. Пожалуйста, введите число.")
|
| 75 |
-
|
| 76 |
-
# Получение списка репозиториев для выбранного варианта
|
| 77 |
-
selected_repos = []
|
| 78 |
-
if choice == 2: # Выбран вариант 2
|
| 79 |
-
selected_repos.extend(install_options["Базовые узлы"])
|
| 80 |
-
selected_repos.extend(install_options["Расширенные узлы"])
|
| 81 |
-
elif choice == 3: # Выбран вариант 3
|
| 82 |
-
selected_repos.extend(install_options["Базовые узлы"])
|
| 83 |
-
selected_repos.extend(install_options["Расширенные узлы"])
|
| 84 |
-
selected_repos.extend(install_options["Все узлы"])
|
| 85 |
-
else:
|
| 86 |
-
selected_repos.extend(install_options[list(install_options.keys())[choice - 1]])
|
| 87 |
-
|
| 88 |
-
# Скачивание custom_nodes
|
| 89 |
-
for repo_url in selected_repos:
|
| 90 |
-
repo_name = repo_url.split("/")[-1].split(".")[0]
|
| 91 |
-
repo_path = os.path.join(custom_nodes_path, repo_name)
|
| 92 |
-
|
| 93 |
-
# Проверка, была ли уже скачана репозитория
|
| 94 |
-
if os.path.exists(repo_path):
|
| 95 |
-
print(f"Репозитория {repo_name} уже скачана.")
|
| 96 |
-
continue
|
| 97 |
-
|
| 98 |
-
# Скачивание репозитории
|
| 99 |
-
print(colored(f"Скачивание {repo_name}...", 'cyan'))
|
| 100 |
-
# print(f"Скачивание {repo_name}...")
|
| 101 |
-
try:
|
| 102 |
-
subprocess.run([os.path.join(git_bin_path, "git"), "clone", repo_url, repo_path], check=True)
|
| 103 |
-
except subprocess.CalledProcessError as e:
|
| 104 |
-
print(f"Ошибка при скачивании {repo_name}: {e}")
|
| 105 |
-
continue
|
| 106 |
-
|
| 107 |
-
# Проверка наличия requirements.txt
|
| 108 |
-
requirements_path = os.path.join(repo_path, "requirements.txt")
|
| 109 |
-
if os.path.exists(requirements_path):
|
| 110 |
-
print(colored(f"Установка зависимостей для {repo_name}...", 'blue'))
|
| 111 |
-
# print(f"Установка зависимостей для {repo_name}...")
|
| 112 |
-
try:
|
| 113 |
-
subprocess.run([os.path.join(python_embeded_path, "python"), "-m", "pip", "install", "-r", requirements_path], check=True)
|
| 114 |
-
except subprocess.CalledProcessError as e:
|
| 115 |
-
print(f"Ошибка при установке зависимостей: {e}")
|
| 116 |
-
|
| 117 |
-
print(colored("Скачивание custom_nodes завершено...", 'green'))
|
| 118 |
-
# print("Скачивание custom_nodes завершено.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|