From 6a4064fd7ed519cc8da285d1e5eaae1d42517162 Mon Sep 17 00:00:00 2001 From: Victor Wong <1606427136@qq.com> Date: Fri, 3 Jan 2025 20:41:20 +0800 Subject: [PATCH 1/2] Allow setting http proxy in updater --- .ci/update_windows/update.py | 16 ++++++++++++---- .ci/update_windows/update_comfyui.bat | 6 ++++-- .ci/update_windows/update_comfyui_stable.bat | 6 ++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.ci/update_windows/update.py b/.ci/update_windows/update.py index 731b6bc5..0cb5d756 100755 --- a/.ci/update_windows/update.py +++ b/.ci/update_windows/update.py @@ -5,10 +5,10 @@ import os import shutil import filecmp -def pull(repo, remote_name='origin', branch='master'): +def pull(repo, remote_name='origin', branch='master', proxy=None): for remote in repo.remotes: if remote.name == remote_name: - remote.fetch() + remote.fetch(proxy=proxy) remote_master_id = repo.lookup_reference('refs/remotes/origin/%s' % (branch)).target merge_result, _ = repo.merge_analysis(remote_master_id) # Up to date, do nothing @@ -46,6 +46,14 @@ def pull(repo, remote_name='origin', branch='master'): pygit2.option(pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0) repo_path = str(sys.argv[1]) +proxy = None +if '--proxy' in sys.argv: + proxy_index = sys.argv.index('--proxy') + if proxy_index + 1 < len(sys.argv): + proxy = sys.argv[proxy_index + 1] + if len(proxy)<=0: + proxy = None + repo = pygit2.Repository(repo_path) ident = pygit2.Signature('comfyui', 'comfy@ui') try: @@ -73,7 +81,7 @@ else: repo.checkout(ref) print("pulling latest changes") # noqa: T201 -pull(repo) +pull(repo, proxy=proxy) if "--stable" in sys.argv: def latest_tag(repo): @@ -143,4 +151,4 @@ try: if not file_size(stable_update_script_to) > 10: shutil.copy(stable_update_script, stable_update_script_to) except: - pass + pass \ No newline at end of file diff --git a/.ci/update_windows/update_comfyui.bat b/.ci/update_windows/update_comfyui.bat index bb08c0de..93e2837d 100755 --- a/.ci/update_windows/update_comfyui.bat +++ b/.ci/update_windows/update_comfyui.bat @@ -1,8 +1,10 @@ @echo off -..\python_embeded\python.exe .\update.py ..\ComfyUI\ +:: Set the http proxy here like `set proxy="http://127.0.0.1:888/"`. No spacebar allowed. +set proxy="" +..\python_embeded\python.exe .\update.py ..\ComfyUI\ --proxy %proxy% if exist update_new.py ( move /y update_new.py update.py echo Running updater again since it got updated. - ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update + ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --proxy %proxy% ) if "%~1"=="" pause diff --git a/.ci/update_windows/update_comfyui_stable.bat b/.ci/update_windows/update_comfyui_stable.bat index e18010da..a9f2c5f0 100755 --- a/.ci/update_windows/update_comfyui_stable.bat +++ b/.ci/update_windows/update_comfyui_stable.bat @@ -1,8 +1,10 @@ @echo off -..\python_embeded\python.exe .\update.py ..\ComfyUI\ --stable +:: Set the http proxy here like `set proxy="http://127.0.0.1:888/"`. No spacebar allowed. +set proxy="" +..\python_embeded\python.exe .\update.py ..\ComfyUI\ --proxy %proxy% --stable if exist update_new.py ( move /y update_new.py update.py echo Running updater again since it got updated. - ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --stable + ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --proxy %proxy% --stable ) if "%~1"=="" pause From 37f38828f121ac0ef7103a9a70b5b0b1804bb9f1 Mon Sep 17 00:00:00 2001 From: Victor Wong <1606427136@qq.com> Date: Mon, 6 Jan 2025 21:40:32 +0800 Subject: [PATCH 2/2] Add new line at end of file --- .ci/update_windows/update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/update_windows/update.py b/.ci/update_windows/update.py index 0cb5d756..d980db4b 100755 --- a/.ci/update_windows/update.py +++ b/.ci/update_windows/update.py @@ -151,4 +151,4 @@ try: if not file_size(stable_update_script_to) > 10: shutil.copy(stable_update_script, stable_update_script_to) except: - pass \ No newline at end of file + pass