[IMPROVED] Separar instalación de Python y pip en rutinas independientes

- Crear función pip_install específica para la instalación de pip
- Simplificar función python3_install para que solo instale Python
- Actualizar bootstrap.sh para verificar pip3 y usar la nueva función
- Mejorar la compatibilidad entre sistemas operativos

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mauro Rosero P. 2025-03-12 09:14:15 -05:00
parent 33d24561a9
commit c98a402b38
Signed by: mrosero
GPG key ID: 83BD2A5F674B7E26
2 changed files with 39 additions and 4 deletions

View file

@ -127,6 +127,13 @@ install() {
then then
python3_install python3_install
fi fi
# Verificar si pip está instalado, instalarlo si es necesario
command_installed pip3
if [ $? -ne 0 ]
then
pip_install
fi
# Install mozilla sops from OS Packages # Install mozilla sops from OS Packages
command_installed $SOPS_PACKAGE command_installed $SOPS_PACKAGE

View file

@ -100,20 +100,20 @@ function python3_install() {
if [ "$(uname)" == "Darwin" ]; then if [ "$(uname)" == "Darwin" ]; then
# En macOS, instalamos o actualizamos Python a través de Homebrew # En macOS, instalamos o actualizamos Python a través de Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python python-pip brew install python
elif [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then elif [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then
# En sistemas Debian y derivados, instalamos o actualizamos Python a través de apt # En sistemas Debian y derivados, instalamos o actualizamos Python a través de apt
apt update apt update
apt install -y python3 python3-pip apt install -y python3
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
# En sistemas Red Hat, instalamos o actualizamos Python a través de yum # En sistemas Red Hat, instalamos o actualizamos Python a través de yum
dnf install -y python3 python3-pip dnf install -y python3
elif [ -f /etc/arch-release ]; then elif [ -f /etc/arch-release ]; then
# En Arch Linux, instalamos o actualizamos Python a través de pacman # En Arch Linux, instalamos o actualizamos Python a través de pacman
pacman -Sy --noconfirm python pacman -Sy --noconfirm python
elif [ -f /etc/rc.conf ]; then elif [ -f /etc/rc.conf ]; then
# En BSD, instalamos o actualizamos Python a través de pkg # En BSD, instalamos o actualizamos Python a través de pkg
pkg install -y python3 python3-pip pkg install -y python3
else else
echo "${os_nofound}" echo "${os_nofound}"
exit 1 exit 1
@ -122,6 +122,34 @@ function python3_install() {
} }
# Install pip package
function pip_install() {
echo "Instalando pip..."
if [ "$(uname)" == "Darwin" ]; then
# En macOS, instalamos o actualizamos pip a través de Homebrew
brew install python-pip
elif [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then
# En sistemas Debian y derivados, instalamos o actualizamos pip a través de apt
apt update
apt install -y python3-pip
elif [ -f /etc/redhat-release ]; then
# En sistemas Red Hat, instalamos o actualizamos pip a través de yum
dnf install -y python3-pip
elif [ -f /etc/arch-release ]; then
# En Arch Linux, instalamos o actualizamos pip a través de pacman
pacman -Sy --noconfirm python-pip
elif [ -f /etc/rc.conf ]; then
# En BSD, instalamos o actualizamos pip a través de pkg
pkg install -y python3-pip
else
echo "${os_nofound}"
exit 1
fi
echo "Pip instalado correctamente."
}
# Install mozilla sops package on os system supported # Install mozilla sops package on os system supported
function sops_install() { function sops_install() {