From 831211b64930949877f901d3a57690c6ea303471 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 10 May 2022 12:22:16 -0400 Subject: [PATCH] Validate existence of environment variables only at the time of usage instead of a global prerequisite for tizen (#18263) --- scripts/build/builders/tizen.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/scripts/build/builders/tizen.py b/scripts/build/builders/tizen.py index b3d3a7c88a06b1..8ca2847d9295ea 100644 --- a/scripts/build/builders/tizen.py +++ b/scripts/build/builders/tizen.py @@ -60,17 +60,6 @@ def __init__(self, root=os.path.join(root, 'examples', app.ExampleName(), 'linux'), runner=runner) - # Make sure that required ENV variables are defined - for env in ('TIZEN_SDK_ROOT', 'TIZEN_SDK_SYSROOT'): - if env not in os.environ: - raise Exception( - "Environment %s missing, cannot build Tizen target" % env) - - self.tizen_sdk_root = os.environ['TIZEN_SDK_ROOT'] - self.tizen_sdk_sysroot = os.environ['TIZEN_SDK_SYSROOT'] - self.tizen_sdk_cli = os.path.join( - self.tizen_sdk_root, "tools/ide/bin/tizen") - self.app = app self.board = board self.extra_gn_options = [] @@ -85,11 +74,17 @@ def __init__(self, raise Exception("TSAN sanitizer not supported by Tizen toolchain") def GnBuildArgs(self): + # Make sure that required ENV variables are defined + for env in ('TIZEN_SDK_ROOT', 'TIZEN_SDK_SYSROOT'): + if env not in os.environ: + raise Exception( + "Environment %s missing, cannot build Tizen target" % env) + return self.extra_gn_options + [ 'target_os="tizen"', 'target_cpu="%s"' % self.board.TargetCpuName(), - 'tizen_sdk_root="%s"' % self.tizen_sdk_root, - 'sysroot="%s"' % self.tizen_sdk_sysroot, + 'tizen_sdk_root="%s"' % os.environ['TIZEN_SDK_ROOT'], + 'sysroot="%s"' % os.environ['TIZEN_SDK_SYSROOT'], ] def build_outputs(self):