aboutsummaryrefslogtreecommitdiffstats
path: root/launch.py
diff options
context:
space:
mode:
authorDepFA <35278260+dfaker@users.noreply.github.com>2022-10-16 16:04:09 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2022-10-18 12:10:09 +0000
commite511b867a9e85e715966c5c60052d67497a4f949 (patch)
tree666e2716b18c63609d6cd7474ea371212bee6c39 /launch.py
parenta647cbc618ea13ce2312f0291ebdfc3b9449e5a1 (diff)
downloadstable-diffusion-webui-gfx803-e511b867a9e85e715966c5c60052d67497a4f949.tar.gz
stable-diffusion-webui-gfx803-e511b867a9e85e715966c5c60052d67497a4f949.tar.bz2
stable-diffusion-webui-gfx803-e511b867a9e85e715966c5c60052d67497a4f949.zip
Make update check commandline option, give response on all paths.
Diffstat (limited to 'launch.py')
-rw-r--r--launch.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/launch.py b/launch.py
index 8484d7c1..9d9dd1b6 100644
--- a/launch.py
+++ b/launch.py
@@ -86,7 +86,24 @@ def git_clone(url, dir, name, commithash=None):
if commithash is not None:
run(f'"{git}" -C {dir} checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")
+
+def version_check(commit):
+ try:
+ import requests
+ commits = requests.get('https://api.github.com/repos/AUTOMATIC1111/stable-diffusion-webui/branches/master').json()
+ if commit != "<none>" and commits['commit']['sha'] != commit:
+ print("--------------------------------------------------------")
+ print("| You are not up to date with the most recent release. |")
+ print("| Consider running `git pull` to update. |")
+ print("--------------------------------------------------------")
+ elif commits['commit']['sha'] == commit:
+ print("You are up to date with the most recent release.")
+ else:
+ print("Not a git clone, can't perform version check.")
+ except Exception as e:
+ print("versipm check failed",e)
+
def prepare_enviroment():
torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113")
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
@@ -165,16 +182,8 @@ def prepare_enviroment():
sys.argv += args
- try:
- import requests
- commits = requests.get('https://api.github.com/repos/AUTOMATIC1111/stable-diffusion-webui/branches/master').json()
- if commit != "<none>" and commits['commit']['sha'] != commit:
- print("--------------------------------------------------------")
- print("| You are not up to date with the most recent release. |")
- print("| Consider running `git pull` to update. |")
- print("--------------------------------------------------------")
- except Exception as e:
- pass
+ if '--update-check' in args:
+ version_check(commit)
if "--exit" in args:
print("Exiting because of --exit argument")