Package entropy :: Package client :: Package interfaces :: Package package :: Class PackageActionFactory

Class PackageActionFactory

source code


Package action factory.

This factory object returns PackageAction instances that can be used to perform a specific activity (like, for instance, the removal, installation or download of a single package).

Example code:

>>> factory = PackageActionFactory(entropy_client)
>>> install = PackageActionFactory.INSTALL_ACTION
>>> obj = factory.get(install, (123, "sabayon-weekly"))
>>> exit_status = obj.start()
>>> obj.finalize()

You can reuse the factory as many times as you want. If you pass an invalid action string, InvalidAction() will be raised. The PackageAction objects (well, their methods) are not thread-safe.

This API is process and thread safe with regards to the Installed Packages Repository. There is no need to do external locking on it.

Nested Classes
  InvalidAction
Raised when the factory is passed an invalid action string.
Instance Methods
 
__init__(self, entropy_client)
Object constructor.
source code
list
supported_actions(self)
Return a list of supported actions.
source code
 
get(self, action, package_match, opts=None)
Return the PackageAction instance associated with the given action.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  INSTALL_ACTION = 'install'
hash(x)
  REMOVE_ACTION = 'remove'
hash(x)
  CONFIG_ACTION = 'config'
hash(x)
  FETCH_ACTION = 'fetch'
hash(x)
  MULTI_FETCH_ACTION = 'multi_fetch'
hash(x)
  SOURCE_ACTION = 'source'
hash(x)
Properties

Inherited from object: __class__

Method Details

__init__(self, entropy_client)
(Constructor)

source code 

Object constructor.

Parameters:
  • entropy_client (entropy.client.interfaces.Client) - a valid Client instance.
Overrides: object.__init__

supported_actions(self)

source code 

Return a list of supported actions.

Returns: list
a list of supported actions

get(self, action, package_match, opts=None)

source code 

Return the PackageAction instance associated with the given action.

Parameters:
  • action (string) - the action string, see supported_actions()
  • package_match (tuple) - an Entropy package match tuple (package_id, repository_id)
  • opts (dict) - metadata options to pass to the PackageAction instance