eye.helpers.build module

Builder processes helpers

This module adds helpers for builders, programs which process source code and build a program out of it or simply check syntax, etc.

class eye.helpers.build.Builder(**kwargs)[source]

Bases: QObject, CategoryMixin

Abstract builder class

Subclasses should reimplement run and columns. They can reimplement interrupt and should emit various signals.

Parameters:

parent – if not given, a default parent is used (a default JobHolder instance)

columns()[source]

Return the list of columns supported by this builder type

The columns are the keys of the dict emitted in warningPrinted and errorPrinted.

This method should be reimplemented in Builder subclasses.

error_printed = Signal(dict)

Signal error_printed(info)

Parameters:

info (dict) – error output by the builder

This signal is emitted when an error occurs.

See warning_printed about the dict argument.

finished = Signal(int)

Signal finished(code)

Parameters:

code (int) – the exit code of the builder

This signal is emitted when the build finishes running, and the overall return code is the argument. By convention, a 0 code means successful end, while 1 and other values mean an error occured or at least warnings.

interrupt()[source]

Stop the builder process

The default implementation does nothing.

progress = Signal(int)

Signal progress(int)

This signal is emitted from time to time to indicate building progress. Some builders may not emit it at all. The argument is a percentage of the progress.

run(*args, **kwargs)[source]

Start the builder process

This method should be reimplemented in Builder subclasses.

started = Signal()

Signal started()

This signal is emitted when the builder starts running.

warning_printed = Signal(dict)

Signal warning_printed(info)

Parameters:

info (dict) – warning output by the builder

This signal is emitted when a warning occurs.

The dict argument contains info about the warning. The keys can be arbitrary and everything is optional, but the common keys are “path”, “line”, “col”, “message”.

working_directory()[source]
class eye.helpers.build.JobHolder(*args, **kwargs)[source]

Bases: QObject

add_job(job)[source]

Re-parents the job to self and un-parent when job is finished.

addJob should be called before the job is started, to avoid the possibility of the job being finished before addJob has done what it should do.

The job is re-parented so a reference is kept. When the job is finished, it is un-parented, which may remove the last reference to it. The goal is that the Builder object may be garbage-collected once it has emitted its finished signal. To achieve this, the JobHolder must be the only one keeping a reference to the job object.

Parameters:

job (eye.helpers.build.Builder) – job to hold

Returns:

the job passed

class eye.helpers.build.SimpleBuilder(**kwargs)[source]

Bases: Builder

Simple builder suitable for gcc-like programs

This builder is suitable for programs outputting lines in the format specified by pattern attribute. Lines not matching this pattern are simply discarded (but the column is optional).

The default pattern looks like “<path>:<line>:<col>: <message>”.

Parameters:

parent – if not given, a default parent is used (a default JobHolder instance)

columns()[source]

Return the list of columns supported by this builder type

The columns are the keys of the dict emitted in warningPrinted and errorPrinted.

This method should be reimplemented in Builder subclasses.

gotLine(line)[source]

This slot has signature gotLine(str).

id = 'command'
interrupt()[source]

Stop the builder process

The default implementation does nothing.

pattern = '^(?P<path>[^:]+):(?P<line>\\d+):(?:(?P<col>\\d+):)? (?P<message>.*)$'
pattern_flags = 0
run(cmd)[source]

Run cmd as builder command

This method should be called by subclasses in run.

run_conf(command, dir, file)[source]
set_working_directory(path)[source]
working_directory()[source]
eye.helpers.build.register_plugin(cls)[source]