Skip to content

Commit 4ad820d

Browse files
committed
Merge branch 'fix/shell-compatibility-associative-arrays' into 'develop'
fix: replace declare -A with POSIX-compatible array syntax for cross-shell compatibility See merge request genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator!283
2 parents 7ec9444 + 9e0815b commit 4ad820d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

publish.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,21 @@ check_python_version() {
9090
check_and_install_packages() {
9191
print_info "Checking required Python packages..."
9292

93-
# List of required packages (import_name:package_name)
94-
declare -A required_packages=(
95-
["typer"]="typer"
96-
["rich"]="rich"
97-
["boto3"]="boto3"
98-
["yaml"]="PyYAML"
93+
# List of required packages (import_name:package_name pairs)
94+
required_packages=(
95+
"typer:typer"
96+
"rich:rich"
97+
"boto3:boto3"
98+
"yaml:PyYAML"
9999
)
100100
missing_packages=()
101101

102102
# Check each package
103-
for import_name in "${!required_packages[@]}"; do
103+
for package_pair in "${required_packages[@]}"; do
104+
import_name="${package_pair%%:*}"
105+
package_name="${package_pair##*:}"
104106
if ! $PYTHON_CMD -c "import $import_name" >/dev/null 2>&1; then
105-
missing_packages+=("${required_packages[$import_name]}")
107+
missing_packages+=("$package_name")
106108
fi
107109
done
108110

0 commit comments

Comments
 (0)