Skip to content

Commit

Permalink
[Silabs] fix non SLC build script (#25926)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 16, 2024
1 parent dade3ce commit 34cf307
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/examples/gn_efr32_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 34cf307

Please sign in to comment.