added function which returns arguments for pype subprocess

This commit is contained in:
iLLiCiTiT 2021-01-29 15:44:43 +01:00
parent 1d940f8b8b
commit 87e60dc5f5
2 changed files with 25 additions and 0 deletions

View file

@ -133,3 +133,26 @@ def run_subprocess(*args, **kwargs):
raise RuntimeError(exc_msg)
return full_output
def get_pype_execute_args():
"""Arguments to run pype command.
Arguments for subprocess when need to spawn new pype process. Which may be
needed when new python process for pype scripts must be executed in build
pype.
## Why is this needed?
Pype executed from code has different executable set to virtual env python
and must have path to script as first argument which is not needed for
build pype.
"""
pype_executable = os.environ["PYPE_EXECUTABLE"]
args = [pype_executable]
executable_filename = os.path.dirname(pype_executable)
if "python" in executable_filename.lower():
args.append(
os.path.join(os.environ["PYPE_ROOT"], "start.py")
)
return args