Skip to content
Snippets Groups Projects
solve_python 1.10 KiB
#! /bin/bash

function solve_python() {
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
pcman=$discover_package_manager_ret

if [ x"$pcman" = x"" ]; then
        exit 1
fi


if [ x"$pcman" == x"apt-get" ]; then
        apt-cache show python-is-python3 | grep -q "python-is-python3"
        if [ $? -eq 0 ]; then
                additional_python_pkg="python-is-python3"
        fi
        apt-cache show python | grep -q "python"
        if [ $? -eq 0 ]; then
                base_python_pkg="python"
        fi
        apt-cache show python2 | grep -q "python2"
        if [ $? -eq 0 ]; then
                base_python_pkg="python2 $base_python_pkg"
        fi
elif [ x"$pcman" == x"zypper -n" ]; then
        base_python_pkg=python2
        additional_python_pkg=python3
fi

if [ x"$1" = x"linux"  ]; then
        pc_install_command "$pcman"
        commands[0]="su -c \"$pc_install_command_ret $base_python_pkg $additional_python_pkg\""
        commands[1]="sudo $pc_install_command_ret $base_python_pkg $additional_python_pkg"
        possible_solutions "${commands[@]}"
fi
}