aboutsummaryrefslogtreecommitdiff
path: root/launch.py
diff options
context:
space:
mode:
authorrandom-thoughtss <116161560+random-thoughtss@users.noreply.github.com>2022-11-03 15:55:54 -0700
committerGitHub <noreply@github.com>2022-11-03 15:55:54 -0700
commit243253ff4a8ae944ba142abe9c1e78a92dd14ebe (patch)
treec40402e18a29ca9a9b167a2f9e47dab39dce0943 /launch.py
parentd9e4e4d7a09d4aee8ce249a3c8e91ce165b10fa5 (diff)
parent20a860b525cb7a319a42994f75a94bbca9a54d89 (diff)
Merge branch 'AUTOMATIC1111:master' into master
Diffstat (limited to 'launch.py')
-rw-r--r--launch.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/launch.py b/launch.py
index 958336f2..ff2f74ba 100644
--- a/launch.py
+++ b/launch.py
@@ -7,6 +7,7 @@ import shlex
import platform
dir_repos = "repositories"
+dir_extensions = "extensions"
python = sys.executable
git = os.environ.get('GIT', "git")
index_url = os.environ.get('INDEX_URL', "")
@@ -16,11 +17,11 @@ def extract_arg(args, name):
return [x for x in args if x != name], name in args
-def run(command, desc=None, errdesc=None):
+def run(command, desc=None, errdesc=None, custom_env=None):
if desc is not None:
print(desc)
- result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=os.environ if custom_env is None else custom_env)
if result.returncode != 0:
@@ -101,9 +102,27 @@ def version_check(commit):
else:
print("Not a git clone, can't perform version check.")
except Exception as e:
- print("versipm check failed",e)
+ print("version check failed", e)
+
+
+def run_extensions_installers():
+ if not os.path.isdir(dir_extensions):
+ return
+
+ for dirname_extension in os.listdir(dir_extensions):
+ path_installer = os.path.join(dir_extensions, dirname_extension, "install.py")
+ if not os.path.isfile(path_installer):
+ continue
+
+ try:
+ env = os.environ.copy()
+ env['PYTHONPATH'] = os.path.abspath(".")
+
+ print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}", custom_env=env))
+ except Exception as e:
+ print(e, file=sys.stderr)
+
-
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")
@@ -189,6 +208,8 @@ def prepare_enviroment():
run_pip(f"install -r {requirements_file}", "requirements for Web UI")
+ run_extensions_installers()
+
if update_check:
version_check(commit)