From c0010cd4415ea0c6a87a8281e0bc735317843f40 Mon Sep 17 00:00:00 2001 From: Cyprien CAILLOT Date: Wed, 11 Sep 2024 11:46:11 +0200 Subject: [PATCH] Enhancement: Ability to disable version validity check --- openpype/lib/__init__.py | 1 + openpype/lib/openpype_version.py | 7 +++++++ openpype/tools/tray/pype_tray.py | 3 ++- start.py | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/openpype/lib/__init__.py b/openpype/lib/__init__.py index b3b12ac2507..758688e0b64 100644 --- a/openpype/lib/__init__.py +++ b/openpype/lib/__init__.py @@ -162,6 +162,7 @@ get_expected_version, is_running_from_build, is_running_staging, + is_validity_check_enabled, is_current_version_studio_latest, is_current_version_higher_than_expected ) diff --git a/openpype/lib/openpype_version.py b/openpype/lib/openpype_version.py index 5618eb0c2eb..d5f7b5a5193 100644 --- a/openpype/lib/openpype_version.py +++ b/openpype/lib/openpype_version.py @@ -146,6 +146,13 @@ def is_running_staging(): return is_staging_enabled() +def is_validity_check_enabled(): + value = os.getenv("OPENPYPE_VALIDITY_CHECK_ENABLED", 'False').lower() + if value == "true" or value == "1": + return True + return False + + # ---------------------------------------- # Functions dependent on OpenPypeVersion # - Make sense to call only in OpenPype process diff --git a/openpype/tools/tray/pype_tray.py b/openpype/tools/tray/pype_tray.py index 769ed4272b9..85d927dd2e7 100644 --- a/openpype/tools/tray/pype_tray.py +++ b/openpype/tools/tray/pype_tray.py @@ -21,6 +21,7 @@ get_installed_version, is_current_version_studio_latest, is_current_version_higher_than_expected, + is_validity_check_enabled, is_running_from_build, get_openpype_version, is_running_staging, @@ -372,7 +373,7 @@ def execute_doubleclick(self): def _on_version_check_timer(self): # Check if is running from build and stop future validations if yes - if not is_running_from_build() or not op_version_control_available(): + if not is_validity_check_enabled() or not is_running_from_build() or not op_version_control_available(): self._version_check_timer.stop() return diff --git a/start.py b/start.py index e4ada05822f..edf86b1d600 100644 --- a/start.py +++ b/start.py @@ -573,6 +573,10 @@ def _process_arguments() -> tuple: commands.append("print_versions") sys.argv.remove("--list-versions") + if "--disable-validity-check" in sys.argv: + commands.append("disable_validity_check") + sys.argv.remove("--disable-validity-check") + # handle igniter # this is helper to run igniter before anything else if "igniter" in sys.argv: @@ -1115,6 +1119,9 @@ def boot(): except KeyError: pass + # Do the program display popups to the users regarding updates or incompatibilities + os.environ["OPENPYPE_VALIDITY_CHECK_ENABLED"] = "False" if "disable_validity_check" in commands else "True" + _print(">>> loading environments ...") # Avalon environments must be set before avalon module is imported _print(" - for Avalon ...")