move update check to after dep installation

This commit is contained in:
DepFA 2022-10-16 10:54:09 +01:00 committed by AUTOMATIC1111
parent 68e83f40bf
commit a647cbc618
1 changed files with 11 additions and 11 deletions

View File

@ -5,7 +5,6 @@ import sys
import importlib.util import importlib.util
import shlex import shlex
import platform import platform
import requests
dir_repos = "repositories" dir_repos = "repositories"
python = sys.executable python = sys.executable
@ -127,16 +126,6 @@ def prepare_enviroment():
print(f"Python {sys.version}") print(f"Python {sys.version}")
print(f"Commit hash: {commit}") print(f"Commit hash: {commit}")
try:
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 not is_installed("torch") or not is_installed("torchvision"): if not is_installed("torch") or not is_installed("torchvision"):
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch")
@ -176,6 +165,17 @@ def prepare_enviroment():
sys.argv += args 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 "--exit" in args: if "--exit" in args:
print("Exiting because of --exit argument") print("Exiting because of --exit argument")
exit(0) exit(0)