display a progressbar for extension installer

This commit is contained in:
Jabasukuriputo Wang 2023-07-22 17:46:50 +08:00 committed by GitHub
parent 90eb731ff1
commit 7afe7375e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import importlib.util
import platform import platform
import json import json
from functools import lru_cache from functools import lru_cache
from tqdm.auto import tqdm
from modules import cmd_args, errors from modules import cmd_args, errors
from modules.paths_internal import script_path, extensions_dir from modules.paths_internal import script_path, extensions_dir
@ -224,7 +225,10 @@ def run_extensions_installers(settings_file):
if not os.path.isdir(extensions_dir): if not os.path.isdir(extensions_dir):
return return
for dirname_extension in list_extensions(settings_file): pbar_extensions = tqdm(list_extensions(settings_file),
bar_format="{desc}: |{bar}|{percentage:3.0f}% [{n_fmt}/{total_fmt} {elapsed}<{remaining}]")
for dirname_extension in pbar_extensions:
pbar_extensions.set_description("Installing %s" % dirname_extension)
run_extension_installer(os.path.join(extensions_dir, dirname_extension)) run_extension_installer(os.path.join(extensions_dir, dirname_extension))