Example #1
0
def execute_instructions(plan, index=None, verbose=False, _commands=None):
    """
    Execute the instructions in the plan

    :param plan: A list of (instruction, arg) tuples
    :param index: The meta-data index
    :param verbose: verbose output
    :param _commands: (For testing only) dict mapping an instruction to executable if None
    then the default commands will be used
    """
    if _commands is None:
        _commands = commands

    if verbose:
        from conda.console import setup_verbose_handlers
        setup_verbose_handlers()

    state = {'i': None, 'prefix': config.root_dir, 'index': index}

    for instruction, arg in plan:

        log.debug(' %s(%r)' % (instruction, arg))

        if state['i'] is not None and instruction in progress_cmds:
            state['i'] += 1
            getLogger('progress.update').info((install.name_dist(arg),
                                               state['i'] - 1))
        cmd = _commands.get(instruction)

        if cmd is None:
            raise InvalidInstruction(instruction)

        cmd(state, arg)

        if (state['i'] is not None and instruction in progress_cmds and
                state['maxval'] == state['i']):
            state['i'] = None
            getLogger('progress.stop').info(None)

    install.messages(state['prefix'])
Example #2
0
=======
>>>>>>> origin/feature/instruction-arguments
=======
<<<<<<< HEAD
>>>>>>> princeofdarkness76/feature/instruction-arguments
=======
>>>>>>> conda/feature/instruction-arguments
>>>>>>> princeofdarkness76/conda
=======
>>>>>>> origin/feature/instruction-arguments
=======
>>>>>>> princeofdarkness76/feature/instruction-arguments
=======
>>>>>>> origin/feature/instruction-arguments
            getLogger('progress.update').info((args[0], state['i']))

        cmd = commands.get(instruction)
>>>>>>> conda/feature/instruction-arguments

        if cmd is None:
            raise InvalidInstruction(instruction)

        cmd(state, *args)

        if (state['i'] is not None and instruction in progress_cmds
                and state['maxval'] == state['i']):
            state['i'] = None
            getLogger('progress.stop').info(None)

    install.messages(state['prefix'])