From 877672f4d600a4a4db980f8f30d230334e952187 Mon Sep 17 00:00:00 2001 From: Jairo Correa Date: Sun, 5 Nov 2023 04:25:30 -0300 Subject: [PATCH] Update script --- update.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 update.py diff --git a/update.py b/update.py new file mode 100644 index 00000000000..f487619e681 --- /dev/null +++ b/update.py @@ -0,0 +1,26 @@ +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): + 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) + +update_repo(BASE_PATH) + +update_custom_nodes()