<commit_before>'''
Install Python packages with pip to either the system or a virtualenv
'''

import os

def _get_pip_bin(bin_env):
    '''
    Return the pip command to call, either from a virtualenv, an argument
    passed in, or from the global modules options
    '''
    if not bin_env:
        # this should be a define somewhere else; pip probably isn't the only
        # thing that cares about this
        rh_like = ('CentOS','Scientific','RedHat','Fedora')
        if __grains__['os'] in rh_like:
            pip_bin = 'pip-python'
        else:
            pip_bin = 'pip'
    else:
        # try to get pip bin from env
        if os.path.exists(os.path.join(bin_env, 'bin', 'pip')):
            pip_bin = os.path.join(bin_env, 'bin', 'pip')
        else:
            pip_bin = bin_env
    return pip_bin


def install(pkgs=None,
            requirements=None,
            env=None,
            bin_env=None,
            log=None,
            proxy=None,
            timeout=None,
            editable=None,
            find_links=None,
            index_url=None,<commit_msg>Change pip to use which_bin<commit_after>'''
Install Python packages with pip to either the system or a virtualenv
'''

# Import python libs
import os

def _get_pip_bin(bin_env):
    '''
    Return the pip command to call, either from a virtualenv, an argument
    passed in, or from the global modules options
    '''
    if not bin_env:
        pips = ['pip2',
                'pip',
                'pip-python']
        return __salt__['cmd.which_bin'](pips)
    else:
        # try to get pip bin from env
        if os.path.exists(os.path.join(bin_env, 'bin', 'pip')):
            pip_bin = os.path.join(bin_env, 'bin', 'pip')
        else:
            pip_bin = bin_env
    return pip_bin


def install(pkgs=None,
            requirements=None,
            env=None,
            bin_env=None,
            log=None,
            proxy=None,
            timeout=None,
            editable=None,
            find_links=None,
            index_url=None,
{'fraction_non_alphanumeric': 0.09637964774951076, 'fraction_numerical': 0.0004892367906066536, 'mean_word_length': 1.8966005665722379, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1027458', 'n_tokens_mistral': 628, 'n_tokens_neox': 610, 'n_words': 184}