示例#1
0
class AbstractPatchSequencingCommand(AbstractPatchProcessingCommand):
    prepare_steps = None
    main_steps = None

    def __init__(self):
        options = []
        self._prepare_sequence = StepSequence(self.prepare_steps)
        self._main_sequence = StepSequence(self.main_steps)
        options = sorted(
            set(self._prepare_sequence.options() +
                self._main_sequence.options()))
        AbstractPatchProcessingCommand.__init__(self, options)

    def _prepare_to_process(self, options, args, tool):
        try:
            self.state = self._prepare_state(options, args, tool)
        except ScriptError as e:
            _log.error(e.message_with_output())
            self._exit(e.exit_code or 2)
        self._prepare_sequence.run_and_handle_errors(tool, options, self.state)

    def _process_patch(self, patch, options, args, tool):
        state = {}
        state.update(self.state or {})
        state["patch"] = patch
        self._main_sequence.run_and_handle_errors(tool, options, state)

    def _prepare_state(self, options, args, tool):
        return None
class AbstractPatchSequencingCommand(AbstractPatchProcessingCommand):
    prepare_steps = None
    main_steps = None

    def __init__(self):
        options = []
        self._prepare_sequence = StepSequence(self.prepare_steps)
        self._main_sequence = StepSequence(self.main_steps)
        options = sorted(set(self._prepare_sequence.options() + self._main_sequence.options()))
        AbstractPatchProcessingCommand.__init__(self, options)

    def _prepare_to_process(self, options, args, tool):
        self._prepare_sequence.run_and_handle_errors(tool, options)

    def _process_patch(self, patch, options, args, tool):
        state = { "patch" : patch }
        self._main_sequence.run_and_handle_errors(tool, options, state)
示例#3
0
class AbstractPatchSequencingCommand(AbstractPatchProcessingCommand):
    prepare_steps = None
    main_steps = None

    def __init__(self):
        options = []
        self._prepare_sequence = StepSequence(self.prepare_steps)
        self._main_sequence = StepSequence(self.main_steps)
        options = sorted(set(self._prepare_sequence.options() + self._main_sequence.options()))
        AbstractPatchProcessingCommand.__init__(self, options)

    def _prepare_to_process(self, options, args, tool):
        self._prepare_sequence.run_and_handle_errors(tool, options)

    def _process_patch(self, patch, options, args, tool):
        state = { "patch" : patch }
        self._main_sequence.run_and_handle_errors(tool, options, state)
示例#4
0
class AbstractPatchSequencingCommand(AbstractPatchProcessingCommand):
    prepare_steps = None
    main_steps = None

    def __init__(self):
        options = []
        self._prepare_sequence = StepSequence(self.prepare_steps)
        self._main_sequence = StepSequence(self.main_steps)
        options = sorted(set(self._prepare_sequence.options() + self._main_sequence.options()))
        AbstractPatchProcessingCommand.__init__(self, options)

    def _prepare_to_process(self, options, args, tool):
        try:
            self.state = self._prepare_state(options, args, tool)
        except ScriptError, e:
            _log.error(e.message_with_output())
            self._exit(e.exit_code or 2)
        self._prepare_sequence.run_and_handle_errors(tool, options, self.state)
class AbstractSequencedCommand(AbstractDeclarativeCommand):
    steps = None
    def __init__(self):
        self._sequence = StepSequence(self.steps)
        AbstractDeclarativeCommand.__init__(self, self._sequence.options())

    def _prepare_state(self, options, args, tool):
        return None

    def execute(self, options, args, tool):
        self._sequence.run_and_handle_errors(tool, options, self._prepare_state(options, args, tool))
示例#6
0
class AbstractSequencedCommand(AbstractDeclarativeCommand):
    steps = None

    def __init__(self):
        self._sequence = StepSequence(self.steps)
        AbstractDeclarativeCommand.__init__(self, self._sequence.options())

    def _prepare_state(self, options, args, tool):
        return None

    def execute(self, options, args, tool):
        self._sequence.run_and_handle_errors(
            tool, options, self._prepare_state(options, args, tool))
示例#7
0
class AbstractSequencedCommand(AbstractDeclarativeCommand):
    steps = None
    def __init__(self):
        self._sequence = StepSequence(self.steps)
        AbstractDeclarativeCommand.__init__(self, self._sequence.options())

    def _prepare_state(self, options, args, tool):
        return None

    def execute(self, options, args, tool):
        try:
            state = self._prepare_state(options, args, tool)
        except ScriptError, e:
            log(e.message_with_output())
            exit(e.exit_code or 2)

        self._sequence.run_and_handle_errors(tool, options, state)
class AbstractSequencedCommand(Command):
    steps = None

    def __init__(self):
        self._sequence = StepSequence(self.steps)
        Command.__init__(self, self._sequence.options())

    def _prepare_state(self, options, args, tool):
        return None

    def execute(self, options, args, tool):
        try:
            state = self._prepare_state(options, args, tool)
        except ScriptError as e:
            _log.error(e.message_with_output(output_limit=5000))
            self._exit(e.exit_code or 2)

        self._sequence.run_and_handle_errors(tool, options, state)