diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-03-25 08:23:41 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-25 08:23:41 +0000 |
commit | c0a7ff8055fa7c629fd22ba49f1cb184442cdd6b (patch) | |
tree | 6311b012c39f0a56f03aeafff59981a022a33fd2 /modules/scripts.py | |
parent | 90410e212f99c29bb4aa6d6bab6595f76a08b5ff (diff) | |
parent | cd3cd0fca0f109662e783a55d12c26837254f11f (diff) | |
download | stable-diffusion-webui-gfx803-c0a7ff8055fa7c629fd22ba49f1cb184442cdd6b.tar.gz stable-diffusion-webui-gfx803-c0a7ff8055fa7c629fd22ba49f1cb184442cdd6b.tar.bz2 stable-diffusion-webui-gfx803-c0a7ff8055fa7c629fd22ba49f1cb184442cdd6b.zip |
Merge pull request #8803 from mlhub-action/fix_scripts_load_order
Fix scripts load order
Diffstat (limited to 'modules/scripts.py')
-rw-r--r-- | modules/scripts.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/scripts.py b/modules/scripts.py index 8f55cf24..d661be4f 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -239,7 +239,15 @@ def load_scripts(): elif issubclass(script_class, scripts_postprocessing.ScriptPostprocessing):
postprocessing_scripts_data.append(ScriptClassData(script_class, scriptfile.path, scriptfile.basedir, module))
- for scriptfile in sorted(scripts_list):
+ def orderby(basedir):
+ # 1st webui, 2nd extensions-builtin, 3rd extensions
+ priority = {os.path.join(paths.script_path, "extensions-builtin"):1, paths.script_path:0}
+ for key in priority:
+ if basedir.startswith(key):
+ return priority[key]
+ return 9999
+
+ for scriptfile in sorted(scripts_list, key=lambda x: [orderby(x.basedir), x]):
try:
if scriptfile.basedir != paths.script_path:
sys.path = [scriptfile.basedir] + sys.path
|