Skip to content

Commit

Permalink
Restored pip check, updated README and Windows ps1 for packages.broad…
Browse files Browse the repository at this point in the history
…com.com
  • Loading branch information
dmurphy18 committed Nov 25, 2024
1 parent d7d0373 commit 6b27fc3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bootstrap-salt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
Salt Bootstrap GitHub Project (script home) - https://github.com/saltstack/salt-bootstrap
Original Vagrant Provisioner Project - https://github.com/saltstack/salty-vagrant
Vagrant Project (utilizes this script) - https://github.com/mitchellh/vagrant
Salt Download Location - https://repo.saltproject.io/salt/py3/windows
Salt Download Location - https://packages.broadcom.com/artifactory/saltproject-generic/windows/
Salt Manual Install Directions (Windows) - https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/windows.html
#>

#===============================================================================
Expand Down
38 changes: 38 additions & 0 deletions bootstrap-salt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,44 @@ __install_salt_from_repo() {

echodebug "Installed pip version: $(${_pip_cmd} --version)"

CHECK_PIP_VERSION_SCRIPT=$(cat << EOM
import sys
try:
import pip
installed_pip_version=tuple([int(part.strip()) for part in pip.__version__.split('.') if part.isdigit()])
desired_pip_version=($(echo ${_MINIMUM_PIP_VERSION} | sed 's/\./, /g' ))
if installed_pip_version < desired_pip_version:
print('Desired pip version {!r} > Installed pip version {!r}'.format('.'.join(map(str, desired_pip_version)), '.'.join(map(str, installed_pip_version))))
sys.exit(1)
print('Desired pip version {!r} < Installed pip version {!r}'.format('.'.join(map(str, desired_pip_version)), '.'.join(map(str, installed_pip_version))))
sys.exit(0)
except ImportError:
print('Failed to import pip')
sys.exit(1)
EOM
)
if ! ${_py_exe} -c "$CHECK_PIP_VERSION_SCRIPT"; then
# Upgrade pip to at least 1.2 which is when we can start using "python3 -m pip"
echodebug "Running '${_pip_cmd} install ${_PIP_INSTALL_ARGS} pip>=${_MINIMUM_PIP_VERSION}'"
${_pip_cmd} install ${_PIP_INSTALL_ARGS} -v "pip>=${_MINIMUM_PIP_VERSION}"
sleep 1
echodebug "PATH: ${PATH}"
_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)"
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
fi
fi
echodebug "Installed pip version: $(${_pip_cmd} --version)"
fi

_setuptools_dep="setuptools>=${_MINIMUM_SETUPTOOLS_VERSION},<${_MAXIMUM_SETUPTOOLS_VERSION}"
if [ "$_PY_MAJOR_VERSION" -ne 3 ]; then
echoerror "Python version is no longer supported, only Python 3"
Expand Down

0 comments on commit 6b27fc3

Please sign in to comment.