mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
'run_ayon_launcher_process' can add sys path to python path
This commit is contained in:
parent
c86613922f
commit
54f22696a9
1 changed files with 9 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue