allows --index-url in requirements.txt

https://github.com/ltdrdata/ComfyUI-Manager/discussions/918
This commit is contained in:
Dr.Lt.Data 2024-08-02 01:53:38 +09:00
parent 1ede7dfe28
commit 5c70089a62
3 changed files with 22 additions and 5 deletions

View File

@ -23,7 +23,7 @@ sys.path.append(glob_path)
import cm_global
from manager_util import *
version = [2, 48, 3]
version = [2, 48, 4]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
@ -405,8 +405,14 @@ def execute_install_script(url, repo_path, lazy_mode=False, instant_execution=Fa
with open(requirements_path, "r") as requirements_file:
for line in requirements_file:
package_name = remap_pip_package(line.strip())
if package_name and not package_name.startswith('#'):
install_cmd = [sys.executable, "-m", "pip", "install", package_name]
if '--index-url' in package_name:
s = package_name.split('--index-url')
install_cmd = [sys.executable, "-m", "pip", "install", s[0].strip(), '--index-url', s[1].strip()]
else:
install_cmd = [sys.executable, "-m", "pip", "install", package_name]
if package_name.strip() != "" and not package_name.startswith('#'):
try_install_script(url, repo_path, install_cmd, instant_execution=instant_execution)
@ -1215,3 +1221,4 @@ def unzip(model_path):
os.remove(model_path)
return True

View File

@ -532,7 +532,12 @@ if os.path.exists(restore_snapshot_path):
package_name = remap_pip_package(line.strip())
if package_name and not is_installed(package_name):
if not package_name.startswith('#'):
install_cmd = [sys.executable, "-m", "pip", "install", package_name]
if '--index-url' in package_name:
s = package_name.split('--index-url')
install_cmd = [sys.executable, "-m", "pip", "install", s[0].strip(), '--index-url', s[1].strip()]
else:
install_cmd = [sys.executable, "-m", "pip", "install", package_name]
this_exit_code += process_wrap(install_cmd, repo_path)
if os.path.exists(install_script_path) and f'{repo_path}/install.py' not in processed_install:
@ -575,7 +580,12 @@ def execute_lazy_install_script(repo_path, executable):
for line in requirements_file:
package_name = remap_pip_package(line.strip())
if package_name and not is_installed(package_name):
install_cmd = [executable, "-m", "pip", "install", package_name]
if '--index-url' in package_name:
s = package_name.split('--index-url')
install_cmd = [sys.executable, "-m", "pip", "install", s[0].strip(), '--index-url', s[1].strip()]
else:
install_cmd = [sys.executable, "-m", "pip", "install", package_name]
process_wrap(install_cmd, repo_path)
if os.path.exists(install_script_path) and f'{repo_path}/install.py' not in processed_install:

View File

@ -1,7 +1,7 @@
[project]
name = "comfyui-manager"
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
version = "2.48.3"
version = "2.48.4"
license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]