portage.util._async.BuildLogger module

class portage.util._async.BuildLogger.BuildLogger(**kwargs)

Bases: _emerge.AsynchronousTask.AsynchronousTask

Write to a log file, with compression support provided by PipeLogger. If the log_filter_file parameter is specified, then it is interpreted as a command to execute which filters log output (see the PORTAGE_LOG_FILTER_FILE_CMD variable in make.conf(5)). The stdin property provides access to a writable binary file stream (refers to a pipe) that log content should be written to (usually redirected from subprocess stdout and stderr streams).

_async_wait()

Subclasses call this method in order to invoke exit listeners when self.returncode is set. Subclasses may override this method in order to perform cleanup. The default implementation for this method simply calls self.wait(), which will immediately raise an InvalidStateError if the event loop is running and self.returncode is None.

_cancel()

Subclasses should implement this, as a template method to be called by AsynchronousTask.cancel().

_cancelled_returncode = -2
_exit_listener_cb(listener)
_exit_listener_handles
_exit_listeners
async _main(filter_proc, pipe_logger)
_main_cancel(filter_proc, pipe_logger)
_main_exit(main_task)
_main_task
_main_task_cancel
_poll()
_start()
_start_hook()
_start_listeners
_stdin
_wait_hook()

Call this method after the task completes, just before returning the returncode from wait() or poll(). This hook is used to trigger exit listeners when the returncode first becomes available.

_was_cancelled()

If cancelled, set returncode if necessary and return True. Otherwise, return False.

addExitListener(f)

The function will be called with one argument, a reference to self.

addStartListener(f)

The function will be called with one argument, a reference to self.

async_wait()

Wait for returncode asynchronously. Notification is available via the add_done_callback method of the returned Future instance.

Returns

Future, result is self.returncode

background
cancel()

Cancel the task, but do not wait for exit status. If asynchronous exit notification is desired, then use addExitListener to add a listener before calling this method. NOTE: Synchronous waiting for status is not supported, since it would be vulnerable to hitting the recursion limit when a large number of tasks need to be terminated simultaneously, like in bug #402335.

cancelled
copy()

Create a new instance and copy all attributes defined from __slots__ (including those from inherited classes).

env
isAlive()
log_filter_file
log_path
poll()
removeExitListener(f)
removeStartListener(f)
returncode
scheduler
start()

Start an asynchronous task and then return as soon as possible.

property stdin
wait()

Wait for the returncode attribute to become ready, and return it. If the returncode is not ready and the event loop is already running, then the async_wait() method should be used instead of wait(), because wait() will raise asyncio.InvalidStateError in this case.

Return type

int

Returns

the value of self.returncode