Skip to content

Commit e61755e

Browse files
Update the old updater if present when running on the windows standalone.
1 parent 36f7fac commit e61755e

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ def load_extra_path_config(yaml_path):
193193
folder_paths.set_temp_directory(temp_dir)
194194
cleanup_temp()
195195

196+
if args.windows_standalone_build:
197+
try:
198+
import new_updater
199+
new_updater.update_windows_updater()
200+
except:
201+
pass
202+
196203
loop = asyncio.new_event_loop()
197204
asyncio.set_event_loop(loop)
198205
server = server.PromptServer(loop)

new_updater.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
import shutil
3+
4+
base_path = os.path.dirname(os.path.realpath(__file__))
5+
6+
7+
def update_windows_updater():
8+
top_path = os.path.dirname(base_path)
9+
updater_path = os.path.join(base_path, ".ci/update_windows/update.py")
10+
bat_path = os.path.join(base_path, ".ci/update_windows/update_comfyui.bat")
11+
12+
dest_updater_path = os.path.join(top_path, "update/update.py")
13+
dest_bat_path = os.path.join(top_path, "update/update_comfyui.bat")
14+
dest_bat_deps_path = os.path.join(top_path, "update/update_comfyui_and_python_dependencies.bat")
15+
16+
try:
17+
with open(dest_bat_path, 'rb') as f:
18+
contents = f.read()
19+
except:
20+
return
21+
22+
if not contents.startswith(b"..\\python_embeded\\python.exe .\\update.py"):
23+
return
24+
25+
shutil.copy(updater_path, dest_updater_path)
26+
try:
27+
with open(dest_bat_deps_path, 'rb') as f:
28+
contents = f.read()
29+
contents = contents.replace(b'..\\python_embeded\\python.exe .\\update.py ..\\ComfyUI\\', b'call update_comfyui.bat nopause')
30+
with open(dest_bat_deps_path, 'wb') as f:
31+
f.write(contents)
32+
except:
33+
pass
34+
shutil.copy(bat_path, dest_bat_path)
35+
print("Updated the windows standalone package updater.")

0 commit comments

Comments
 (0)