From 39233653f893b7ffc547d174dfb52bfd2f61cc9f Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 14 Sep 2021 15:56:09 +0200 Subject: [PATCH] added 'is_running_from_build' function --- openpype/lib/pype_info.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/openpype/lib/pype_info.py b/openpype/lib/pype_info.py index ec04f50532..2feeab7cae 100644 --- a/openpype/lib/pype_info.py +++ b/openpype/lib/pype_info.py @@ -25,10 +25,23 @@ def get_pype_version(): return get_openpype_version() +def is_running_from_build(): + """Determine if current process is running from build or code. + + Returns: + bool: True if running from build. + """ + executable_path = os.environ["OPENPYPE_EXECUTABLE"] + executable_filename = os.path.basename(executable_path) + if "python" in executable_filename.lower(): + return False + return True + + def get_pype_info(): """Information about currently used Pype process.""" executable_args = get_pype_execute_args() - if len(executable_args) == 1: + if is_running_from_build(): version_type = "build" else: version_type = "code"