forked from comfyanonymous/ComfyUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.py
28 lines (20 loc) · 787 Bytes
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import subprocess
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
def update_repo(fullpath):
git_path = os.path.join(fullpath, '.git')
requirements_path = os.path.join(fullpath, 'requirements.txt')
if os.path.isdir(git_path):
print(fullpath)
subprocess.run("git pull", shell=True, cwd=fullpath)
if os.path.exists(requirements_path):
print(fullpath)
subprocess.run("pip install -r requirements.txt", shell=True, cwd=fullpath)
def update_custom_nodes():
for filename in sorted(os.listdir(os.path.join(BASE_PATH, "custom_nodes"))):
fullpath = os.path.join(BASE_PATH, "custom_nodes", filename)
update_repo(fullpath)
def update_base():
update_repo(BASE_PATH)
update_base()
update_custom_nodes()