'run_ayon_launcher_process' can add sys path to python path

This commit is contained in:
Jakub Trllo 2024-07-17 15:27:39 +02:00
parent c86613922f
commit 54f22696a9

View file

@ -179,7 +179,7 @@ def clean_envs_for_ayon_process(env=None):
return env
def run_ayon_launcher_process(*args, **kwargs):
def run_ayon_launcher_process(*args, add_sys_paths=False, **kwargs):
"""Execute AYON process with passed arguments and wait.
Wrapper for 'run_process' which prepends AYON executable arguments
@ -209,6 +209,14 @@ def run_ayon_launcher_process(*args, **kwargs):
# - fill more if you find more
env = clean_envs_for_ayon_process(os.environ)
if add_sys_paths:
new_pythonpath = list(sys.path)
for path in env.get("PYTHONPATH", "").split(os.pathsep):
if not path or path in new_pythonpath:
continue
new_pythonpath.append(path)
env["PYTHONPATH"] = os.pathsep.join(new_pythonpath)
return run_subprocess(args, env=env, **kwargs)