kentauros.actions package

Submodules

kentauros.actions.abstract module

This submodule contains the quasi-abstract Action class, which is inherited by specific action implementations.

class kentauros.actions.abstract.Action(pkg_name: str)[source]

Bases: object

This class is the base class for all defined actions. For every action that can be specified at ktr command line, there is an Action subclass.

Parameters:

pkg_name (str) – Package instance this action will be run on

Variables:
  • name (str) – stores the package configuration name given at initialisation
  • kpkg (Package) – stores reference to the package object
  • atype (ActionType) – stores type of action as enum
execute()[source]

This method runs the action corresponding to the Action instance on the package specified at initialisation. It is overridden by subclasses to contain the real code for the action. Also, it is expected that actions update the package database after they have finished successfully.

import_status()[source]

This method imports a package’s and all its sub-module’s status to the package database.

update_status()[source]

This method writes a package’s and all its sub-module’s status to the package database. It is executed after actions.

kentauros.actions.build module

This submodule contains the BuildAction class.

class kentauros.actions.build.BuildAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for executing a local build of the package specified at initialisation.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.BUILD
execute() → bool[source]

This method runs the action corresponding to the Action instance on the package specified at initialisation. It is overridden by subclasses to contain the real code for the action. Also, it is expected that actions update the package database after they have finished successfully.

kentauros.actions.chain module

This submodule contains the ChainAction class.

class kentauros.actions.chain.ChainAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for executing a “chain reaction” on the package specified at initialisation, which means the following:

  • get sources if they don’t already exist (GetAction)
  • update sources (UpdateAction)
  • if sources already existed, no updates were available and --force was not specified, action execution will terminate at this point and return False
  • otherwise, sources are exported (if tarball doesn’t already exist) (ExportAction)
  • construct source package (ConstructAction), terminate chain if not successful
  • build source package locally (BuildAction), terminate chain if not successful
  • upload source package to cloud build service (UploadAction)
Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.CHAIN
execute() → bool[source]

This method runs the “chain reaction” corresponding to the package specified at initialisation, with the configuration from the package configuration file.

Returns:boolTrue if chain went all the way through, False if not

kentauros.actions.clean module

This submodule contains the CleanAction class.

class kentauros.actions.clean.CleanAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for cleaning up the sources of the package specified at initialisation.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.CLEAN
execute() → bool[source]

This method cleans up the sources of to the package specified at initialisation. It executes the Source.clean() method of the Source instance in the specified package.

Returns:bool – always True at the moment

kentauros.actions.common module

This submodule contains code that is shared by submodules in this subpackage.

kentauros.actions.common.LOGPREFIX = 'ktr/actions'

This string specifies the prefix for log and error messages printed to stdout or stderr from inside this subpackage.

kentauros.actions.construct module

This submodule contains the ConstructAction class.

class kentauros.actions.construct.ConstructAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for constructing the source package from sources and package specification for the package specified at initialisation.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.CONSTRUCT
execute() → bool[source]

This method runs the action corresponding to the Action instance on the package specified at initialisation. It is overridden by subclasses to contain the real code for the action. Also, it is expected that actions update the package database after they have finished successfully.

kentauros.actions.importing module

This submodule contains the ImportAction class.

class kentauros.actions.importing.ImportAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains methods for importing packages which are not yet configured for use with kentauros.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.IMPORT
execute() → bool[source]

This method prints a pretty summary of a package’s configuration values to the console. Currently, this does nothing whatsoever.

kentauros.actions.prepare module

This submodule contains the PrepareAction class.

class kentauros.actions.prepare.PrepareAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for preparing the package’s sources. Sources will be downloaded or copied to destination, updated if already there, and exported to a tarball, if necessary.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.PREPARE
execute() → bool[source]

This method executes the Source.prepare() method to execute source preparation. This includes downloading or copying to destination, updating if necessary, and exporting to tarball if necessary.

Returns:boolTrue when successful, False if sub-action fails

kentauros.actions.status module

This submodule contains the StatusAction class.

class kentauros.actions.status.StatusAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for displaying packages which are configured for use with kentauros. At the moment, this only includes printing a list of packages, which is done by default when kentauros is run. More status messages are plannned for the future.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.STATUS
execute() → bool[source]

This method prints a pretty summary of a package’s configuration values to the console. Currently, this does nothing whatsoever.

kentauros.actions.upload module

This submodule contains the UploadAction class.

class kentauros.actions.upload.UploadAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for uploading the buildable source package to a cloud service (or similar) as specified in the package configuration.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.UPLOAD
execute() → bool[source]

This method executes the Uploader.upload() method to execute the source upload, if possible - this only has effect for packages with a valid uploader specified in the package configuration file.

Returns:bool – always True, future error checking still missing

kentauros.actions.verify module

This submodule contains the VerifyAction class.

class kentauros.actions.verify.VerifyAction(pkg_name: str)[source]

Bases: kentauros.actions.abstract.Action

This Action subclass contains information for making sure the package’s configuration file is valid and everything needed for actions is in place.

Parameters:pkg_name (str) – Package name for which status will be printed
Variables:atype (ActionType) – here: stores ActionType.VERIFY
execute() → bool[source]

This method executes a verification of the package configuration and checks if every file necessary for actions is present (and valid). The real checks are done during package initialisation.

Module contents

This subpackage contains the quasi-abstract Action class and its subclasses, which are used to hold information about the action specified at command line and are used to execute their respective actions. Additionally, this file contains a dictionary which maps ActionType enums to their respective class constructors.

kentauros.actions.ACTION_DICT = {<ActionType.CLEAN: 30>: <class 'kentauros.actions.clean.CleanAction'>, <ActionType.VERIFY: 12>: <class 'kentauros.actions.verify.VerifyAction'>, <ActionType.CONSTRUCT: 21>: <class 'kentauros.actions.construct.ConstructAction'>, <ActionType.BUILD: 22>: <class 'kentauros.actions.build.BuildAction'>, <ActionType.STATUS: 11>: <class 'kentauros.actions.status.StatusAction'>, <ActionType.PREPARE: 20>: <class 'kentauros.actions.prepare.PrepareAction'>, <ActionType.CHAIN: 40>: <class 'kentauros.actions.chain.ChainAction'>, <ActionType.UPLOAD: 23>: <class 'kentauros.actions.upload.UploadAction'>, <ActionType.IMPORT: 10>: <class 'kentauros.actions.importing.ImportAction'>}

This dictionary maps ActionType enum members to their respective Action subclass constructors.