From 93a0d49dcdcdf4f10c74c8c55acd24cb94b3c02c Mon Sep 17 00:00:00 2001 From: Heewa Barfchin Date: Mon, 1 Jun 2026 17:54:58 -0400 Subject: [PATCH 1/2] Use pip from specified python version --- bootstrap-salt.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 10dc84122..931de6ece 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2739,23 +2739,21 @@ __install_salt_from_repo() { echodebug "__install_salt_from_repo py_exe=$_py_exe" _py_version=$(${_py_exe} -c "import sys; print('{0}.{1}'.format(*sys.version_info))") - _pip_cmd="pip${_py_version}" - if ! __check_command_exists "${_pip_cmd}"; then - echodebug "The pip binary '${_pip_cmd}' was not found in PATH" - _pip_cmd="pip$(echo "${_py_version}" | cut -c -1)" + _pip_cmd="${_py_exe} -m pip" + _pip_version="$(${_pip_cmd} --version)" + if [ -z "${_pip_version}" ]; then + echodebug "Pip is not installed for Python '${_py_exe}' (version ${_py_version})" + _pip_cmd="pip${_py_version}" if ! __check_command_exists "${_pip_cmd}"; then echodebug "The pip binary '${_pip_cmd}' was not found in PATH" - _pip_cmd="pip" - if ! __check_command_exists "${_pip_cmd}"; then - echoerror "Unable to find a pip binary" - return 1 - fi + echoerror "Unable to find a pip binary" + return 1 fi fi __check_pip_allowed - echodebug "Installed pip version: $(${_pip_cmd} --version)" + echodebug "Installed pip version: $_pip_version" _setuptools_dep="setuptools>=${_MINIMUM_SETUPTOOLS_VERSION},<${_MAXIMUM_SETUPTOOLS_VERSION}" if [ "$_PY_MAJOR_VERSION" -ne 3 ]; then From 0ae25f3e3c3586b5643abc70f012e7a6a56e22b7 Mon Sep 17 00:00:00 2001 From: Twangboy Date: Mon, 31 Aug 2026 13:33:36 -0600 Subject: [PATCH 2/2] Fix pip --version check to use exit code and refresh version after fallback Check the exit status of '$_pip_cmd --version' directly instead of relying on captured-output emptiness, silence stderr so a missing pip module doesn't dump a traceback, and re-capture _pip_version after the pip${_py_version} fallback succeeds so it isn't reported empty even though a working pip binary was found. --- bootstrap-salt.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 931de6ece..ff15c4306 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2740,8 +2740,9 @@ __install_salt_from_repo() { _py_version=$(${_py_exe} -c "import sys; print('{0}.{1}'.format(*sys.version_info))") _pip_cmd="${_py_exe} -m pip" - _pip_version="$(${_pip_cmd} --version)" - if [ -z "${_pip_version}" ]; then + if ${_pip_cmd} --version > /dev/null 2>&1; then + _pip_version="$(${_pip_cmd} --version 2>/dev/null)" + else echodebug "Pip is not installed for Python '${_py_exe}' (version ${_py_version})" _pip_cmd="pip${_py_version}" if ! __check_command_exists "${_pip_cmd}"; then @@ -2749,6 +2750,7 @@ __install_salt_from_repo() { echoerror "Unable to find a pip binary" return 1 fi + _pip_version="$(${_pip_cmd} --version 2>/dev/null)" fi __check_pip_allowed