def _get_pip_bin(bin_env):
 if (not bin_env):
  which_result = __salt__['cmd.which_bin'](['pip', 'pip2', 'pip3', 'pip-python'])
  if (which_result is None):
   raise CommandNotFoundError('Could not find a `pip` binary')
  if salt.utils.is_windows():
   return which_result.encode('string-escape')
  return which_result
 if os.path.isdir(bin_env):
  if salt.utils.is_windows():
   pip_bin = os.path.join(bin_env, 'Scripts', 'pip.exe').encode('string-escape')
  else:
   pip_bin = os.path.join(bin_env, 'bin', 'pip')
  if os.path.isfile(pip_bin):
   return pip_bin
  msg = 'Could not find a `pip` binary in virtualenv {0}'.format(bin_env)
  raise CommandNotFoundError(msg)
 elif os.access(bin_env, os.X_OK):
  if (os.path.isfile(bin_env) or os.path.islink(bin_env)):
   return bin_env
 else:
  raise CommandNotFoundError('Could not find a `pip` binary')

def _get_pip_bin ( bin_env ) : if ( not bin_env ) : which_result = __salt__ [ 'cmd.which_bin' ] ( [ 'pip' , 'pip2' , 'pip3' , 'pip-python' ] ) if ( which_result is None ) : raise CommandNotFoundError ( 'Could not find a `pip` binary' ) if salt . utils . is_windows ( ) : return which_result . encode ( 'string-escape' ) return which_result if os . path . isdir ( bin_env ) : if salt . utils . is_windows ( ) : pip_bin = os . path . join ( bin_env , 'Scripts' , 'pip.exe' ) . encode ( 'string-escape' ) else : pip_bin = os . path . join ( bin_env , 'bin' , 'pip' ) if os . path . isfile ( pip_bin ) : return pip_bin msg = 'Could not find a `pip` binary in virtualenv {0}' . format ( bin_env ) raise CommandNotFoundError ( msg ) elif os . access ( bin_env , os . X_OK ) : if ( os . path . isfile ( bin_env ) or os . path . islink ( bin_env ) ) : return bin_env else : raise CommandNotFoundError ( 'Could not find a `pip` binary' )
locate the pip binary .