fixed: pre_startup - restart if script is executed

fixed: normalize cnr versions via StrictVersion
- 2.5 and 2.5.0 were regarded as different version
This commit is contained in:
Dr.Lt.Data 2025-02-15 17:21:45 +09:00
parent 12351bada7
commit abc26cf906
4 changed files with 35 additions and 4 deletions

View File

@ -173,7 +173,10 @@ def read_cnr_info(fullpath):
project = data.get('project', {})
name = project.get('name').strip().lower()
version = project.get('version')
# normalize version
# for example: 2.5 -> 2.5.0
version = str(manager_util.StrictVersion(project.get('version')))
urls = project.get('urls', {})
repository = urls.get('Repository')

View File

@ -42,7 +42,7 @@ import manager_downloader
from node_package import InstalledNodePackage
version_code = [3, 21, 2]
version_code = [3, 21, 3]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
@ -513,7 +513,10 @@ class UnifiedManager:
if info:
cnr = self.cnr_map.get(info['id'])
if cnr:
return {'id': cnr['id'], 'cnr': cnr, 'ver': info['version']}
# normalize version
# for example: 2.5 -> 2.5.0
ver = str(manager_util.StrictVersion(info['version']))
return {'id': cnr['id'], 'cnr': cnr, 'ver': ver}
else:
return None
else:

View File

@ -679,6 +679,7 @@ def execute_migration(moves):
shutil.move(x[0], x[1])
print(f"[ComfyUI-Manager] MIGRATION: '{x[0]}' -> '{x[1]}'")
script_executed = False
# Check if script_list_path exists
if os.path.exists(script_list_path):
@ -733,6 +734,7 @@ if os.path.exists(script_list_path):
# Remove the script_list_path file
if os.path.exists(script_list_path):
script_executed = True
os.remove(script_list_path)
print("\n[ComfyUI-Manager] Startup script completed.")
@ -744,6 +746,29 @@ del processed_install
del pip_fixer
manager_util.clear_pip_cache()
if script_executed:
# Restart
print("[ComfyUI-Manager] Restarting to reapply dependency installation.")
if '__COMFY_CLI_SESSION__' in os.environ:
with open(os.path.join(os.environ['__COMFY_CLI_SESSION__'] + '.reboot'), 'w'):
pass
print("--------------------------------------------------------------------------\n")
exit(0)
else:
sys_argv = sys.argv.copy()
if sys.platform.startswith('win32'):
cmds = ['"' + sys.executable + '"', '"' + sys_argv[0] + '"'] + sys_argv[1:]
else:
cmds = [sys.executable] + sys_argv
print(f"Command: {cmds}", flush=True)
print("--------------------------------------------------------------------------\n")
os.execv(sys.executable, cmds)
def check_windows_event_loop_policy():
try:

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 = "3.21.2"
version = "3.21.3"
license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]