@@ -512,7 +512,11 @@ install_python() {
512512 if [ ${ADJUSTED_ID} = " debian" ]; then
513513 check_packages python3 python3-doc python3-pip python3-venv python3-dev python3-tk
514514 else
515- check_packages python3 python3-pip python3-devel python3-tkinter
515+ if [ ${ID} != " mariner" ]; then
516+ check_packages python3 python3-pip python3-devel python3-tkinter
517+ else
518+ check_packages python3 python3-pip python3-devel
519+ fi
516520 fi
517521 INSTALL_PATH=" /usr"
518522
@@ -619,7 +623,6 @@ case ${ADJUSTED_ID} in
619623 shadow-utils \
620624 sqlite-devel \
621625 tar \
622- tk-devel \
623626 uuid-devel \
624627 which \
625628 xmlsec1-devel \
@@ -630,6 +633,11 @@ case ${ADJUSTED_ID} in
630633 REQUIRED_PKGS=" ${REQUIRED_PKGS} \
631634 curl"
632635 fi
636+ # Mariner does not have tk-devel package available
637+ if [ ${ID} != " mariner" ]; then
638+ REQUIRED_PKGS=" ${REQUIRED_PKGS} \
639+ tk-devel"
640+ fi
633641 ;;
634642esac
635643
@@ -693,7 +701,7 @@ if [[ "${INSTALL_PYTHON_TOOLS}" = "true" ]] && [[ $(python --version) != "" ]];
693701 find " ${PIPX_HOME} " -type d -print0 | xargs -0 -n 1 chmod g+s
694702
695703 # Update pip if not using os provided python
696- if [[ $( python --version) != " " ]] || [[ ${PYTHON_VERSION} != " os-provided" ]] && [[ ${PYTHON_VERSION} != " system" ]] && [[ ${PYTHON_VERSION} != " none" ]]; then
704+ if [[ $( python --version 2> /dev/null ) != " " ]] && [[ ${PYTHON_VERSION} != " os-provided" ]] && [[ ${PYTHON_VERSION} != " system" ]] && [[ ${PYTHON_VERSION} != " none" ]]; then
697705 echo " Updating pip..."
698706 python -m pip install --no-cache-dir --upgrade pip
699707 fi
@@ -703,7 +711,15 @@ if [[ "${INSTALL_PYTHON_TOOLS}" = "true" ]] && [[ $(python --version) != "" ]];
703711 export PIP_CACHE_DIR=/tmp/pip-tmp/cache
704712 PIPX_DIR=" "
705713 if ! type pipx > /dev/null 2>&1 ; then
706- pip3 install --disable-pip-version-check --no-cache-dir --user pipx 2>&1
714+ break_system_packages=" "
715+ if [ ${ADJUSTED_ID} = " debian" ] && [ ${MAJOR_VERSION_ID} -ge 12 ]; then
716+ # Debian versions >= 12 require that we use pip with the "--break-system-packages"
717+ # option to avoid errors... This does not really breack system packages due
718+ # to the setting of PYTHONUSERBASE above, but does get us past Debian checks for
719+ # installing python packages into the system python install.
720+ break_system_packages=" --break-system-packages"
721+ fi
722+ pip3 install ${break_system_packages} --disable-pip-version-check --no-cache-dir --user pipx 2>&1
707723 /tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
708724 PIPX_DIR=" /tmp/pip-tmp/bin/"
709725 fi
0 commit comments