run installers for newly installed extensions
This commit is contained in:
parent
a1a376331c
commit
98947d173e
20
launch.py
20
launch.py
|
@ -105,24 +105,28 @@ def version_check(commit):
|
||||||
print("version check failed", e)
|
print("version check failed", e)
|
||||||
|
|
||||||
|
|
||||||
def run_extensions_installers():
|
def run_extension_installer(extension_dir):
|
||||||
if not os.path.isdir(dir_extensions):
|
path_installer = os.path.join(extension_dir, "install.py")
|
||||||
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):
|
if not os.path.isfile(path_installer):
|
||||||
continue
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['PYTHONPATH'] = os.path.abspath(".")
|
env['PYTHONPATH'] = os.path.abspath(".")
|
||||||
|
|
||||||
print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}", custom_env=env))
|
print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {extension_dir}", custom_env=env))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e, file=sys.stderr)
|
print(e, file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
|
def run_extensions_installers():
|
||||||
|
if not os.path.isdir(dir_extensions):
|
||||||
|
return
|
||||||
|
|
||||||
|
for dirname_extension in os.listdir(dir_extensions):
|
||||||
|
run_extension_installer(os.path.join(dir_extensions, dirname_extension))
|
||||||
|
|
||||||
|
|
||||||
def prepare_enviroment():
|
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")
|
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")
|
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
|
||||||
|
|
|
@ -134,6 +134,9 @@ def install_extension_from_url(dirname, url):
|
||||||
|
|
||||||
os.rename(tmpdir, target_dir)
|
os.rename(tmpdir, target_dir)
|
||||||
|
|
||||||
|
import launch
|
||||||
|
launch.run_extension_installer(target_dir)
|
||||||
|
|
||||||
extensions.list_extensions()
|
extensions.list_extensions()
|
||||||
return [extension_table(), html.escape(f"Installed into {target_dir}. Use Installed tab to restart.")]
|
return [extension_table(), html.escape(f"Installed into {target_dir}. Use Installed tab to restart.")]
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue