ahriman.application package

Subpackages

Submodules

ahriman.application.ahriman module

ahriman.application.help_formatter module

ahriman.application.interactive_shell module

class InteractiveShell(locals=None, filename='<console>')

Bases: InteractiveConsole

wrapper around code.InteractiveConsole to pass interact() to IPython shell

Constructor.

The optional locals argument will be passed to the InteractiveInterpreter base class.

The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks.

static has_ipython() bool

check if IPython shell is available

Returns:

True if IPython shell is available, False otherwise

Return type:

bool

interact(*args: Any, **kwargs: Any) None

pass controller to IPython shell

Parameters:
  • *args (Any) – positional arguments

  • **kwargs (Any) – keyword arguments

ahriman.application.lock module

class Lock(args: Namespace, repository_id: RepositoryId, configuration: Configuration)

Bases: LazyLogging

wrapper for application lock file. Credits for idea to https://github.com/bmhatfield/python-pidfile.git

force

remove lock file on start if any

Type:

bool

path

path to lock file if any

Type:

Path

reporter

build status reporter instance

Type:

Client

paths

repository paths instance

Type:

RepositoryPaths

unsafe

skip user check

Type:

bool

wait_timeout

wait in seconds until lock will free

Type:

int

Examples

Instance of this class except for controlling file-based lock is also required for basic applications checks. The common flow is to create instance in with block and handle exceptions after all:

>>> from ahriman.core.configuration import Configuration
>>> from ahriman.models.repository_id import RepositoryId
>>>
>>> configuration = Configuration()
>>> try:
>>>     with Lock(args, RepositoryId("x86_64", "aur"), configuration):
>>>         do_something()
>>> except Exception as exception:
>>>     handle_exceptions(exception)
Parameters:
  • args (argparse.Namespace) – command line args

  • repository_id (RepositoryId) – repository unique identifier

  • configuration (Configuration) – configuration instance

static perform_lock(fd: int) bool

perform file lock

Parameters:

fd (int) – file descriptor:

Returns:

True in case if file is locked and False otherwise

Return type:

bool

check_user() None

check if current user is actually owner of ahriman root

check_version() None

check web server version

clear() None

remove lock file

lock() None

create pid file

Module contents