Skip to content

Commit ffa8927

Browse files
dafyddjtwangboy
authored andcommitted
fix: reinstate the old method of setting pip global options
* older distributions that use `pip` versions older than v22.1 are still supported e.g. Debian 11
1 parent 5202647 commit ffa8927

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

bootstrap-salt.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,12 +2821,25 @@ __install_salt_from_repo() {
28212821

28222822
echodebug "Running '${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --no-deps --force-reinstall ${_PIP_INSTALL_ARGS} ${_TMP_DIR}/git/deps/salt*.whl'"
28232823

2824-
echodebug "Running ${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --no-deps --force-reinstall ${_PIP_INSTALL_ARGS} --config-settings=--global-option=--salt-config-dir=$_SALT_ETC_DIR --salt-cache-dir=${_SALT_CACHE_DIR} ${SETUP_PY_INSTALL_ARGS} ${_TMP_DIR}/git/deps/salt*.whl"
2825-
2826-
${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --no-deps --force-reinstall \
2827-
${_PIP_INSTALL_ARGS} \
2828-
--config-settings="--global-option=--salt-config-dir=$_SALT_ETC_DIR --salt-cache-dir=${_SALT_CACHE_DIR} ${SETUP_PY_INSTALL_ARGS}" \
2829-
${_TMP_DIR}/git/deps/salt*.whl || return 1
2824+
_PIP_VERSION_STRING=$(${_pip_cmd} --version)
2825+
echodebug "Installed pip version: $_PIP_VERSION_STRING"
2826+
_PIP_MAJOR_VERSION=$(echo "$_PIP_VERSION_STRING" | sed -E 's/^pip ([0-9]+)\..*/\1/')
2827+
2828+
# The following branching can be removed once we no longer support distros that still ship with
2829+
# versions of `pip` earlier than v22.1 such as Debian 11
2830+
if [ "$_PIP_MAJOR_VERSION" -lt 23 ]; then
2831+
echodebug "Running ${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --no-deps --force-reinstall ${_PIP_INSTALL_ARGS} --global-option=--salt-config-dir=$_SALT_ETC_DIR --salt-cache-dir=${_SALT_CACHE_DIR} ${SETUP_PY_INSTALL_ARGS} ${_TMP_DIR}/git/deps/salt*.whl"
2832+
${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --no-deps --force-reinstall \
2833+
${_PIP_INSTALL_ARGS} \
2834+
--global-option="--salt-config-dir=$_SALT_ETC_DIR --salt-cache-dir=${_SALT_CACHE_DIR} ${SETUP_PY_INSTALL_ARGS}" \
2835+
${_TMP_DIR}/git/deps/salt*.whl || return 1
2836+
else
2837+
echodebug "Running ${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --no-deps --force-reinstall ${_PIP_INSTALL_ARGS} --config-settings=--global-option=--salt-config-dir=$_SALT_ETC_DIR --salt-cache-dir=${_SALT_CACHE_DIR} ${SETUP_PY_INSTALL_ARGS} ${_TMP_DIR}/git/deps/salt*.whl"
2838+
${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --no-deps --force-reinstall \
2839+
${_PIP_INSTALL_ARGS} \
2840+
--config-settings="--global-option=--salt-config-dir=$_SALT_ETC_DIR --salt-cache-dir=${_SALT_CACHE_DIR} ${SETUP_PY_INSTALL_ARGS}" \
2841+
${_TMP_DIR}/git/deps/salt*.whl || return 1
2842+
fi
28302843

28312844
echoinfo "Checking if Salt can be imported using ${_py_exe}"
28322845
CHECK_SALT_SCRIPT=$(cat << EOM

0 commit comments

Comments
 (0)