kitir/_libs/package_utils.py
def verify_pip(get_if_needed=True, raise_on_failure=True, **kwargs):
    """
    verify that pip exists on machine
    :param get_if_needed: get pip if missing
    :param raise_on_failure: raise exception if no pip at the end
    :return: returns the pip base if all is okay, or false otherwise (or raises exception)
    """
    log.trace('verifying pip exists: get_if_needed={}'.format(get_if_needed))

    kwargs.setdefault('to_console', False)
    kwargs.setdefault('trace_file', ir_artifact_dir + '/packages/pip/verify_pip.trace.out')

    def _check_for_pip():
        for pip_base in pip_commands:
            ret = iexec('{} --version'.format(pip_base), **kwargs)
            if ret.rc == 0 and ret.contains(('pip', 'python2')):
                log.trace('pip verified: base={} out={}'.format(pip_base, ret.out))
                return pip_base
        return False

    base = _check_for_pip()
    if base is False:
        if get_if_needed and running_on_linux:
            wget_base = 'wget'
            log.warning('pip was missing, trying to install')
            iexec('{} "https://bootstrap.pypa.io/get-pip.py" -O "/tmp/get-pip.py"'.format(wget_base), **kwargs)
            get_pip_cmd = 'python "/tmp/get-pip.py"'
            iexec(get_pip_cmd, **kwargs)
            base = _check_for_pip()

    if base is False:
        if get_if_needed and running_on_linux:
            log.error('pip failed even after trying to install')
        else:
            log.error('pip is missing from machine')
        if raise_on_failure:
            raise Exception('No pip found')
        return False

    return base

    verify that pip exists on machine
    :param get_if_needed: get pip if missing
    :param raise_on_failure: raise exception if no pip at the end
    :return: returns the pip base if all is okay, or false otherwise (or raises exception)
    
verify that pip exists on machine
verify that pip exists on machine
def verify_pip(get_if_needed=True, raise_on_failure=True, **kwargs):
    log.trace('verifying pip exists: get_if_needed={}'.format(get_if_needed))
    kwargs.setdefault('to_console', False)
    kwargs.setdefault('trace_file', ir_artifact_dir + '/packages/pip/verify_pip.trace.out')
    def _check_for_pip():
        for pip_base in pip_commands:
            ret = iexec('{} --version'.format(pip_base), **kwargs)
            if ret.rc == 0 and ret.contains(('pip', 'python2')):
                log.trace('pip verified: base={} out={}'.format(pip_base, ret.out))
                return pip_base
        return False
    base = _check_for_pip()
    if base is False:
        if get_if_needed and running_on_linux:
            wget_base = 'wget'
            log.warning('pip was missing, trying to install')
            iexec('{} "https://bootstrap.pypa.io/get-pip.py" -O "/tmp/get-pip.py"'.format(wget_base), **kwargs)
            get_pip_cmd = 'python "/tmp/get-pip.py"'
            iexec(get_pip_cmd, **kwargs)
            base = _check_for_pip()
    if base is False:
        if get_if_needed and running_on_linux:
            log.error('pip failed even after trying to install')
        else:
            log.error('pip is missing from machine')
        if raise_on_failure:
            raise Exception('No pip found')
        return False
    return base
def verify_pip ( get_if_needed = True , raise_on_failure = True , ** kwargs ) : log . trace ( 'verifying pip exists: get_if_needed={}' . format ( get_if_needed ) ) kwargs . setdefault ( 'to_console' , False ) kwargs . setdefault ( 'trace_file' , ir_artifact_dir + '/packages/pip/verify_pip.trace.out' ) def _check_for_pip ( ) : for pip_base in pip_commands : ret = iexec ( '{} --version' . format ( pip_base ) , ** kwargs ) if ret . rc == 0 and ret . contains ( ( 'pip' , 'python2' ) ) : log . trace ( 'pip verified: base={} out={}' . format ( pip_base , ret . out ) ) return pip_base return False base = _check_for_pip ( ) if base is False : if get_if_needed and running_on_linux : wget_base = 'wget' log . warning ( 'pip was missing, trying to install' ) iexec ( '{} "https://bootstrap.pypa.io/get-pip.py" -O "/tmp/get-pip.py"' . format ( wget_base ) , ** kwargs ) get_pip_cmd = 'python "/tmp/get-pip.py"' iexec ( get_pip_cmd , ** kwargs ) base = _check_for_pip ( ) if base is False : if get_if_needed and running_on_linux : log . error ( 'pip failed even after trying to install' ) else : log . error ( 'pip is missing from machine' ) if raise_on_failure : raise Exception ( 'No pip found' ) return False return base
verify that pip exists on machine
verify that pip exists on machine
"""
    verify that pip exists on machine
    :param get_if_needed: get pip if missing
    :param raise_on_failure: raise exception if no pip at the end
    :return: returns the pip base if all is okay, or false otherwise (or raises exception)
    """
returns the pip base if all is okay, or false otherwise (or raises exception)
returns the pip base if all is okay or false otherwise ( or raises exception )
get_if_needed
get pip if missing
get pip if missing
raise_on_failure
raise exception if no pip at the end
raise exception if no pip at the end