Skip to content

Commit 4c3c21e

Browse files
committed
always force a reinstall as pyenv versions are getting removed everytime
1 parent 2a11bd7 commit 4c3c21e

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

scripts/evergreen/setup_aws.sh

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,35 +42,31 @@ install_aws_cli_binary() {
4242
install_aws_cli_pip() {
4343
echo "Installing AWS CLI v1 via pip (for IBM architectures)..."
4444

45-
# Ensure pip is available
46-
if ! command -v pip3 &> /dev/null && ! command -v pip &> /dev/null; then
47-
echo "Error: pip is not available. Please install Python and pip first." >&2
45+
if [[ ! -d "${PROJECT_DIR}/venv" ]]; then
46+
echo "Error: Python venv not found at ${PROJECT_DIR}/venv. Please run recreate_python_venv.sh first." >&2
4847
return 1
4948
fi
5049

51-
# Check if AWS CLI exists and works before installing
50+
# Activate the venv
51+
source "${PROJECT_DIR}/venv/bin/activate"
52+
53+
# Check if AWS CLI exists and works in the venv
5254
if command -v aws &> /dev/null; then
5355
if aws --version > /dev/null 2>&1; then
54-
echo "AWS CLI is already installed and working"
56+
echo "AWS CLI is already installed and working in venv"
5557
return 0
5658
else
57-
echo "AWS CLI exists but not functional (likely bad Python shebang), reinstalling..."
58-
pip3 uninstall -y awscli || true
59+
echo "AWS CLI exists but not functional, reinstalling in venv..."
60+
pip uninstall -y awscli || true
5961
fi
6062
fi
6163

62-
echo "Installing AWS CLI using pip3..."
63-
pip3 install --user awscli
64-
65-
# Add ~/.local/bin to PATH if not already there (where pip --user installs)
66-
if [[ ":${PATH}:" != *":${HOME}/.local/bin:"* ]]; then
67-
export PATH="${HOME}/.local/bin:${PATH}"
68-
echo "Added ~/.local/bin to PATH"
69-
fi
64+
echo "Installing AWS CLI into venv using pip..."
65+
pip install awscli
7066

7167
# Verify installation
7268
if command -v aws &> /dev/null; then
73-
echo "AWS CLI v1 installed successfully"
69+
echo "AWS CLI v1 installed successfully in venv"
7470
else
7571
echo "Error: AWS CLI v1 installation failed" >&2
7672
return 1

0 commit comments

Comments
 (0)