Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make bootstrap.sh more friendly to other shells. #27392

Merged
merged 8 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ exclude:
- "zzz_generated/**/*" # already clang-formatted by our zap tooling
- "src/controller/java/generated/java/**/*" # not formatted: generated files
- "src/controller/java/zap-generated/**/*" # not formatted: generated files
- "scripts/setup/bootstrap.sh" # tries to quote loop variable


changed_paths:
Expand Down
15 changes: 9 additions & 6 deletions scripts/setup/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _install_additional_pip_requirements() {
shift

# figure out additional pip install items
while [[ $# -gt 0 ]]; do
while [ $# -gt 0 ]; do
case $1 in
-p | --platform)
_SETUP_PLATFORM=$2
Expand All @@ -32,13 +32,14 @@ _install_additional_pip_requirements() {
esac
done

if ! [ -z "$_SETUP_PLATFORM" ]; then
if [ -n "$_SETUP_PLATFORM" ]; then
_OLD_IFS=$IFS
IFS=","
if [ -n "$ZSH_VERSION" ]; then
IFS="," read -r -A _PLATFORMS <<<"$_SETUP_PLATFORM"
else
IFS="," read -r -a _PLATFORMS <<<"$_SETUP_PLATFORM"
setopt local_options shwordsplit
fi
for platform in "${_PLATFORMS[@]}"; do

for platform in ${_SETUP_PLATFORM}; do
# Allow none as an alias of nothing extra installed (like -p none)
if [ "$platform" != "none" ]; then
echo "Installing pip requirements for $platform..."
Expand All @@ -47,6 +48,8 @@ _install_additional_pip_requirements() {
-c "$_CHIP_ROOT/scripts/setup/constraints.txt"
fi
done
IFS=$_OLD_IFS
unset _OLD_IFS
unset _PLATFORMS
fi

Expand Down