From 3438919068abe3e573b29bfc04140e8a9c0693d5 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Mon, 30 Dec 2024 15:23:54 +0800 Subject: [PATCH] fix: update Python installation script to require version specification - Modified the Python installation script to remove the default version assignment and enforce version specification during installation. - Updated usage instructions to reflect the change from a default version to requiring a user-defined version, improving clarity and preventing installation errors. - This change enhances the robustness of the installation process by ensuring users explicitly define the Python version they wish to install. --- docker/base-image/install/python/python.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docker/base-image/install/python/python.sh b/docker/base-image/install/python/python.sh index 65e73c19..25d5525d 100644 --- a/docker/base-image/install/python/python.sh +++ b/docker/base-image/install/python/python.sh @@ -7,7 +7,7 @@ set -e print_usage() { echo "Usage: $0 [version] [requirements]" echo "Commands:" - echo " install - Install Python version (default: 3.12)" + echo " install - Install Python version (default: latest)" echo " uninstall - Uninstall Python version" echo " switch - Switch to a different Python version" echo " list - List installed Python versions" @@ -104,8 +104,8 @@ handle_requirements() { } # Main logic -command="${1:-install}" -version="${2:-3.12.8}" +command="${1:-}" +version="${2:-}" requirements="${3:-}" case $command in @@ -113,6 +113,10 @@ case $command in setup_pyenv ;; "install") + if [ -z "$version" ]; then + echo "Please specify a version to install" + exit 1 + fi setup_pyenv # Check if version is already installed if pyenv versions | grep -q $version; then