Skip to content

Commit

Permalink
allows --index-url in requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed Aug 1, 2024
1 parent 1ede7df commit 5c70089
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
11 changes: 9 additions & 2 deletions glob/manager_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
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 '')


Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -1215,3 +1221,4 @@ def unzip(model_path):
os.remove(model_path)
return True


14 changes: 12 additions & 2 deletions prestartup_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,12 @@ def msg_capture(stream, prefix):
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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down

0 comments on commit 5c70089

Please sign in to comment.