From 34cf3079697dcfec3539a5a9bb9939acffcd39a2 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Fri, 31 Mar 2023 23:21:27 -0400 Subject: [PATCH] [Silabs] fix non SLC build script (#25926) * Added avariable to let the script use the venv python when not using SLC * Restyled by shellharden * Restyled by shfmt * moved the PYTHON_PATH to be after activate.sh * Restyled by shfmt --------- Co-authored-by: Restyled.io --- scripts/examples/gn_efr32_example.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index 25ffa25daa69db..8f2221e694bb6a 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -268,12 +268,16 @@ else } &>/dev/null fi - if [ "$USE_SLC" == true ] && [ "$GN_PATH_PROVIDED" == false ]; then - GN_PATH=./.environment/cipd/packages/pigweed/gn + if [ "$USE_SLC" == true ]; then + PYTHON_PATH="/usr/bin/python3" + if [ "$GN_PATH_PROVIDED" == false ]; then + GN_PATH=./.environment/cipd/packages/pigweed/gn + fi elif [ "$USE_SLC" == false ]; then # Activation needs to be after SLC generation which is done in gn gen. # Zap generation requires activation and is done in the build phase source "$CHIP_ROOT/scripts/activate.sh" + PYTHON_PATH=$VIRTUAL_ENV"/bin/python3" fi BUILD_DIR=$OUTDIR/$SILABS_BOARD @@ -296,9 +300,9 @@ else fi if [ -z "$optArgs" ]; then - "$GN_PATH" gen --check --script-executable="/usr/bin/python3" --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\"" "$BUILD_DIR" + "$GN_PATH" gen --check --script-executable="$PYTHON_PATH" --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\"" "$BUILD_DIR" else - "$GN_PATH" gen --check --script-executable="/usr/bin/python3" --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR" + "$GN_PATH" gen --check --script-executable="$PYTHON_PATH" --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR" fi fi