From c2b6f199c61a4e66e0cdd963a80d6967038eca4f Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 2 Jul 2021 16:46:52 +0200 Subject: [PATCH] fail if invalid version format requested --- start.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/start.py b/start.py index cd6be0a7dd..b2fff4eac0 100644 --- a/start.py +++ b/start.py @@ -348,6 +348,12 @@ def _process_arguments() -> tuple: if "+staging" in use_version: use_staging = True break + else: + _print("!!! Requested version isn't in correct format.") + _print((" Use --list-versions to find out" + " proper version string.")) + sys.exit(1) + if "--use-staging" in sys.argv: use_staging = True sys.argv.remove("--use-staging") @@ -607,7 +613,8 @@ def _bootstrap_from_code(use_version, use_staging): _openpype_root = OPENPYPE_ROOT if getattr(sys, 'frozen', False): local_version = bootstrap.get_version(Path(_openpype_root)) - _print(f" - running version: {local_version}") + switch_str = f" - will switch to {use_version}" if use_version else "" + _print(f" - booting version: {local_version}{switch_str}") assert local_version else: # get current version of OpenPype @@ -706,8 +713,13 @@ def boot(): use_version, use_staging, print_versions = _process_arguments() if os.getenv("OPENPYPE_VERSION"): - use_staging = "staging" in os.getenv("OPENPYPE_VERSION") - use_version = os.getenv("OPENPYPE_VERSION") + if use_version: + _print(("*** environment variable OPENPYPE_VERSION" + "is overridden by command line argument.")) + else: + _print(">>> version set by environment variable") + use_staging = "staging" in os.getenv("OPENPYPE_VERSION") + use_version = os.getenv("OPENPYPE_VERSION") # ------------------------------------------------------------------------ # Determine mongodb connection