From 99461068c56955478126f69ad20d6d5dd74e7324 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Jun 2023 11:40:54 -0400 Subject: [PATCH] Make the comma split work in zsh (#27347) * Make the comma split work in zsh * Update string substitution a bit * Remove extra conditional * Use zsh_version to determine how to read * Slight simplification * Cleanup variables as well * Restyled by shfmt --------- Co-authored-by: Andrei Litvin Co-authored-by: Restyled.io --- scripts/setup/bootstrap.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/setup/bootstrap.sh b/scripts/setup/bootstrap.sh index af00b719fcfd5d..925183b9e3f353 100644 --- a/scripts/setup/bootstrap.sh +++ b/scripts/setup/bootstrap.sh @@ -33,7 +33,11 @@ _install_additional_pip_requirements() { done if ! [ -z "$_SETUP_PLATFORM" ]; then - IFS="," read -r -a _PLATFORMS <<<"$_SETUP_PLATFORM" + if [ -n "$ZSH_VERSION" ]; then + IFS="," read -r -A _PLATFORMS <<<"$_SETUP_PLATFORM" + else + IFS="," read -r -a _PLATFORMS <<<"$_SETUP_PLATFORM" + fi for platform in "${_PLATFORMS[@]}"; do # Allow none as an alias of nothing extra installed (like -p none) if [ "$platform" != "none" ]; then @@ -43,7 +47,10 @@ _install_additional_pip_requirements() { -c "$_CHIP_ROOT/scripts/setup/constraints.txt" fi done + unset _PLATFORMS fi + + unset _SETUP_PLATFORM } _bootstrap_or_activate() {