Exemplo n.º 1
0
def install(*args, **kwargs):  # pylint: disable=function-redefined
    log.debug('custom pip module // pip.install called')
    pip_binary = get_pip_bin(kwargs.get('bin_env'))
    if isinstance(pip_binary, list):
        pip_binary = pip_binary[0]
    kwargs['bin_env'] = pip_binary
    env_vars = kwargs.pop('env_vars', None)
    if not env_vars:
        env_vars = {}
    # Some packages are not really competent at handling systems with poorly setup locales
    # Since this state tree properly configures the locale and yet, some packages, moto,
    # still fail under Python 3, let's explicitly set PYTHONIOENCODING environment variable
    # to utf-8
    if 'PYTHONIOENCODING' not in env_vars:
        log.debug(
            'Explicitly setting environment variable "PYTHONIOENCODING=utf-8')
        env_vars['PYTHONIOENCODING'] = 'utf-8'
    if 'LC_ALL' not in env_vars:
        log.debug(
            'Explicitly setting environment variable "LC_ALL=en_US.UTF-8"')
        env_vars['LC_ALL'] = 'en_US.UTF-8'
    kwargs['env_vars'] = env_vars
    if kwargs.get('cwd') is None:
        if salt.utils.platform.is_windows():
            # On windows, the cwd must the same directory as the pip executable
            kwargs['cwd'] = os.path.dirname(pip_binary)
        else:
            kwargs['cwd'] = '/'
    cache_pip_version(pip_binary, kwargs.get('cwd'))
    return pip_install(*args, **kwargs)
Exemplo n.º 2
0
def install(*args, **kwargs):  # pylint: disable=function-redefined
    pip_binary = _get_pip_bin(kwargs.get('bin_env'))
    kwargs['bin_env'] = pip_binary
    env_vars = kwargs.pop('env_vars', None)
    if not env_vars:
        env_vars = {}
    # Some packages are not really competent at handling systems with poorly setup locales
    # Since this state tree properly configures the locale and yet, some packages, moto,
    # still fail under Python 3, let's explicitly set PYTHONIOENCODING environment variable
    # to utf-8
    if 'PYTHONIOENCODING' not in env_vars:
        log.debug('Explicitly setting environment variable "PYTHONIOENCODING=utf-8')
        env_vars['PYTHONIOENCODING'] = 'utf-8'
    if 'LC_ALL' not in env_vars:
        log.debug('Explicitly setting environment variable "LC_ALL=en_US.UTF-8"')
        env_vars['LC_ALL'] = 'en_US.UTF-8'
    kwargs['env_vars'] = env_vars
    return pip_install(*args, **kwargs)
Exemplo n.º 3
0
def install(*args, **kwargs):  # pylint: disable=function-redefined
    pip_binary = _get_pip_bin(kwargs.get('bin_env'))
    if isinstance(pip_binary, list):
        pip_binary = pip_binary[0]
    kwargs['bin_env'] = pip_binary
    env_vars = kwargs.pop('env_vars', None)
    if not env_vars:
        env_vars = {}
    # Some packages are not really competent at handling systems with poorly setup locales
    # Since this state tree properly configures the locale and yet, some packages, moto,
    # still fail under Python 3, let's explicitly set PYTHONIOENCODING environment variable
    # to utf-8
    if 'PYTHONIOENCODING' not in env_vars:
        log.debug('Explicitly setting environment variable "PYTHONIOENCODING=utf-8')
        env_vars['PYTHONIOENCODING'] = 'utf-8'
    if 'LC_ALL' not in env_vars:
        log.debug('Explicitly setting environment variable "LC_ALL=en_US.UTF-8"')
        env_vars['LC_ALL'] = 'en_US.UTF-8'
    kwargs['env_vars'] = env_vars
    return pip_install(*args, **kwargs)
Exemplo n.º 4
0
def install(*args, **kwargs):  # pylint: disable=function-redefined
    pip_binary = _get_pip_bin(kwargs.get('bin_env'))
    kwargs['bin_env'] = pip_binary
    return pip_install(*args, **kwargs)