Ejemplo n.º 1
0
Archivo: pip.py Proyecto: kienluu/fabs
def update_dynamic_pip_requirements():
    if not env.PIP_DYNAMIC_REQUIREMENT_PATH:
        print red('File at env.DYNAMIC_PIP_REQUIREMENT_PATH(%s) does not exist.'\
              % env.PIP_DYNAMIC_REQUIREMENT_PATH)
        return
    if not files.exists(env.PIP_DYNAMIC_REQUIREMENT_PATH):
        print red('File at env.DYNAMIC_PIP_REQUIREMENT_PATH(%s) does not exist.' \
                % env.PIP_DYNAMIC_REQUIREMENT_PATH)
        return
    with virtualenv():
        run('pip install -r %s' % env.PIP_DYNAMIC_REQUIREMENT_PATH)
Ejemplo n.º 2
0
Archivo: pip.py Proyecto: kienluu/fabs
def _get_frozen_requirements():
    if env.PIP_DYNAMIC_REQUIREMENT_PATH:
        dynamic_reqs = run('cat %s' % env.PIP_DYNAMIC_REQUIREMENT_PATH)
        dynamic_egg_list = _get_eggs(dynamic_reqs)
        with virtualenv():
            freeze_output = run('pip freeze').stdout
        # Results from run include a '\r\n' in them.  Regex does not treat \r\n
        # as a newline.  So we must remove this.
        freeze_output = normalise_newlines(freeze_output)
        for egg_name in dynamic_egg_list:
            # Python 2.6 re.sub command does not take flags so compile the pattern.
            # Also, I'm not sure why the DOTALL flag is needed here.
            pattern = re.compile(r'^.+?#egg=%s$' % egg_name, flags=re.MULTILINE)
            freeze_output = pattern.sub('', freeze_output)
            # Remove empty lines
        freeze_output = '\n'.join([line for line in freeze_output.split('\n')
                                   if line.strip()])
    else:
        with virtualenv():
            freeze_output = run('pip freeze').stdout
            freeze_output = normalise_newlines(freeze_output)
    return freeze_output
Ejemplo n.º 3
0
Archivo: pip.py Proyecto: kienluu/fabs
def update_frozen_pip_requirements():
    """
    This is actually going to use
    """
    if not env.PIP_REQUIREMENT_PATH:
        print red('env.PIP_REQUIREMENT_PATH not set.')
        return
    if not files.exists(env.PIP_REQUIREMENT_PATH):
        print red('File at env.PIP_REQUIREMENT_PATH(%s) does not exist.' \
                % env.PIP_REQUIREMENT_PATH)
        return
    with virtualenv():
        out = _get_frozen_requirements()
        pip_file_out = run('cat %s' % env.PIP_REQUIREMENT_PATH).stdout
        pip_file_out = normalise_newlines(pip_file_out)
        if out == pip_file_out:
            print green('pip requirements are upto date.')
            return

        run('pip install -r %s' % env.PIP_REQUIREMENT_PATH)