mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Look for currently-running python's pip first
This improves pip detection on hosts where "pip" exists and refers to a different Python version from the Python under which Salt is running. It does so by getting the major and minor version from sys.version_info and looking for pipX.Y before checking the rest of the potential names for pip.
This commit is contained in:
parent
e210eaead4
commit
effe8b9432
@ -81,6 +81,7 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import logging
|
||||
import sys
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
@ -118,7 +119,10 @@ def _get_pip_bin(bin_env):
|
||||
executable itself, or from searching conventional filesystem locations
|
||||
'''
|
||||
if not bin_env:
|
||||
which_result = __salt__['cmd.which_bin'](['pip', 'pip2', 'pip3', 'pip-python'])
|
||||
which_result = __salt__['cmd.which_bin'](
|
||||
['pip{0}.{1}'.format(*sys.version_info[:2]),
|
||||
'pip', 'pip2', 'pip3', 'pip-python']
|
||||
)
|
||||
if which_result is None:
|
||||
raise CommandNotFoundError('Could not find a `pip` binary')
|
||||
if salt.utils.is_windows():
|
||||
|
Loading…
Reference in New Issue
Block a user