Bypass ComfyUI version check when in electron env (#1303)
* Hacky: hide the features we do not want to ship with electron app * Backup * Take install path for cm-cli. * Remove unused. * Add no deps. * Add no deps. * Bypass ComfyUI version check when in electron env * Fix exception when comfyui is not repo * Fix version reporting always skipped * Log unhandled errors --------- Co-authored-by: Yoland Y <4950057+yoland68@users.noreply.github.com> Co-authored-by: Robin Huang <robin.j.huang@gmail.com>
This commit is contained in:
@@ -53,8 +53,8 @@ def get_custom_nodes_paths():
|
||||
|
||||
|
||||
def get_comfyui_tag():
|
||||
repo = git.Repo(comfy_path)
|
||||
try:
|
||||
repo = git.Repo(comfy_path)
|
||||
return repo.git.describe('--tags')
|
||||
except:
|
||||
return None
|
||||
@@ -82,6 +82,7 @@ comfy_ui_required_commit_datetime = datetime(2024, 1, 24, 0, 0, 0)
|
||||
comfy_ui_revision = "Unknown"
|
||||
comfy_ui_commit_datetime = datetime(1900, 1, 1, 0, 0, 0)
|
||||
|
||||
is_electron = os.environ.get("ORIGINAL_XDG_CURRENT_DESKTOP") != None
|
||||
|
||||
cache_lock = threading.Lock()
|
||||
|
||||
@@ -432,7 +433,7 @@ def __win_check_git_pull(path):
|
||||
process.wait()
|
||||
|
||||
|
||||
def execute_install_script(url, repo_path, lazy_mode=False, instant_execution=False):
|
||||
def execute_install_script(url, repo_path, lazy_mode=False, instant_execution=False, no_deps=False):
|
||||
install_script_path = os.path.join(repo_path, "install.py")
|
||||
requirements_path = os.path.join(repo_path, "requirements.txt")
|
||||
|
||||
@@ -440,7 +441,7 @@ def execute_install_script(url, repo_path, lazy_mode=False, instant_execution=Fa
|
||||
install_cmd = ["#LAZY-INSTALL-SCRIPT", sys.executable]
|
||||
try_install_script(url, repo_path, install_cmd)
|
||||
else:
|
||||
if os.path.exists(requirements_path):
|
||||
if os.path.exists(requirements_path) and not no_deps:
|
||||
print("Install: pip packages")
|
||||
pip_fixer = PIPFixer(get_installed_packages())
|
||||
with open(requirements_path, "r") as requirements_file:
|
||||
@@ -584,7 +585,7 @@ def is_valid_url(url):
|
||||
return False
|
||||
|
||||
|
||||
def gitclone_install(files, instant_execution=False, msg_prefix=''):
|
||||
def gitclone_install(files, instant_execution=False, msg_prefix='', install_path=None, no_deps=False):
|
||||
print(f"{msg_prefix}Install: {files}")
|
||||
for url in files:
|
||||
if not is_valid_url(url):
|
||||
@@ -594,9 +595,9 @@ def gitclone_install(files, instant_execution=False, msg_prefix=''):
|
||||
if url.endswith("/"):
|
||||
url = url[:-1]
|
||||
try:
|
||||
print(f"Download: git clone '{url}'")
|
||||
print(f"Download: git clone '{url}' to {install_path}")
|
||||
repo_name = os.path.splitext(os.path.basename(url))[0]
|
||||
repo_path = os.path.join(get_default_custom_nodes_path(), repo_name)
|
||||
repo_path = os.path.join(install_path or get_default_custom_nodes_path(), repo_name)
|
||||
|
||||
# Clone the repository from the remote URL
|
||||
if not instant_execution and platform.system() == 'Windows':
|
||||
@@ -608,7 +609,7 @@ def gitclone_install(files, instant_execution=False, msg_prefix=''):
|
||||
repo.git.clear_cache()
|
||||
repo.close()
|
||||
|
||||
if not execute_install_script(url, repo_path, instant_execution=instant_execution):
|
||||
if not execute_install_script(url, repo_path, instant_execution=instant_execution, no_deps=no_deps):
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user