diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-03-25 09:08:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-25 09:08:24 +0000 |
commit | 8dbe793af53194ff3054bfbc9529a10f961bdbd3 (patch) | |
tree | 087f31c96c6b0280c75cfca4380638cde72ff90e /modules/ui_extensions.py | |
parent | 8e3ced73a8c8f435809de544e0574da265177289 (diff) | |
parent | 70615448b2ef3285dba9bb1992974cb1eaf10995 (diff) | |
download | stable-diffusion-webui-gfx803-8dbe793af53194ff3054bfbc9529a10f961bdbd3.tar.gz stable-diffusion-webui-gfx803-8dbe793af53194ff3054bfbc9529a10f961bdbd3.tar.bz2 stable-diffusion-webui-gfx803-8dbe793af53194ff3054bfbc9529a10f961bdbd3.zip |
Merge branch 'master' into extra-network-info
Diffstat (limited to 'modules/ui_extensions.py')
-rw-r--r-- | modules/ui_extensions.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index df75a925..4a502974 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -1,6 +1,5 @@ import json
import os.path
-import shutil
import sys
import time
import traceback
@@ -141,22 +140,20 @@ def install_extension_from_url(dirname, url): try:
shutil.rmtree(tmpdir, True)
-
- repo = git.Repo.clone_from(url, tmpdir)
- repo.remote().fetch()
-
+ with git.Repo.clone_from(url, tmpdir) as repo:
+ repo.remote().fetch()
+ for submodule in repo.submodules:
+ submodule.update()
try:
os.rename(tmpdir, target_dir)
except OSError as err:
- # TODO what does this do on windows? I think it'll be a different error code but I don't have a system to check it
- # Shouldn't cause any new issues at least but we probably want to handle it there too.
if err.errno == errno.EXDEV:
# Cross device link, typical in docker or when tmp/ and extensions/ are on different file systems
# Since we can't use a rename, do the slower but more versitile shutil.move()
shutil.move(tmpdir, target_dir)
else:
# Something else, not enough free space, permissions, etc. rethrow it so that it gets handled.
- raise(err)
+ raise err
import launch
launch.run_extension_installer(target_dir)
@@ -244,7 +241,7 @@ def refresh_available_extensions_from_data(hide_tags, sort_column): hidden += 1
continue
- install_code = f"""<input onclick="install_extension_from_index(this, '{html.escape(url)}')" type="button" value="{"Install" if not existing else "Installed"}" {"disabled=disabled" if existing else ""} class="gr-button gr-button-lg gr-button-secondary">"""
+ install_code = f"""<button onclick="install_extension_from_index(this, '{html.escape(url)}')" {"disabled=disabled" if existing else ""} class="lg secondary gradio-button custom-button">{"Install" if not existing else "Installed"}</button>"""
tags_text = ", ".join([f"<span class='extension-tag' title='{tags.get(x, '')}'>{x}</span>" for x in extension_tags])
|