Merge pull request #8803 from mlhub-action/fix_scripts_load_order
Fix scripts load order
This commit is contained in:
commit
c0a7ff8055
@ -239,7 +239,15 @@ def load_scripts():
|
|||||||
elif issubclass(script_class, scripts_postprocessing.ScriptPostprocessing):
|
elif issubclass(script_class, scripts_postprocessing.ScriptPostprocessing):
|
||||||
postprocessing_scripts_data.append(ScriptClassData(script_class, scriptfile.path, scriptfile.basedir, module))
|
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:
|
try:
|
||||||
if scriptfile.basedir != paths.script_path:
|
if scriptfile.basedir != paths.script_path:
|
||||||
sys.path = [scriptfile.basedir] + sys.path
|
sys.path = [scriptfile.basedir] + sys.path
|
||||||
|
Loading…
Reference in New Issue
Block a user