Package Integrator :: Module Spiff_Integrator :: Class PackageManager

Class PackageManager



object --+
         |
        PackageManager

The API that you want to use.

Instance Methods
 
__init__(self, guard, package_api)
Constructor.
 
install(self)
Installs the package manager.
 
set_package_dir(self, dirname)
Defines the directory into which new packages are installed, and from which they are loaded.
Package
create_package(self, dirname)
Creates an empty package in the given directory.
Package
read_package(self, filename)
Reads the package with the given filename without installing it.
Package
install_package(self, package)
Installs the given package.
 
remove_package(self, package)
Uninstalls the given package.
 
remove_package_from_id(self, id)
Uninstalls the package with the given id.
list[Package]
get_package_list(self, offset=0, limit=0, **kwargs)
Returns a list of all installed packages.
list[Package]
get_listeners(self, uri)
Returns a list of all packages that are subscribed to the signal with the given URI.
Package
get_package_from_descriptor(self, descriptor)
Returns the Package object that matches the given descriptor.
Package
get_package_from_name(self, name)
Returns the Package object with the given name.
Package
get_package_from_instance(self, instance)
Given an instance of the loaded package, this function returns the corresponding Package object.

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

Properties

Inherited from object: __class__

Method Details

__init__(self, guard, package_api)
(Constructor)

 
Constructor.
Parameters:
  • guard (Guard) - The Spiff Guard instance.
  • package_api (Api) - The API that is made available to all packages.
Overrides: object.__init__

set_package_dir(self, dirname)

 
Defines the directory into which new packages are installed, and from which they are loaded.
Parameters:
  • dirname (os.path) - The package directory.

create_package(self, dirname)

 
Creates an empty package in the given directory. Raises an exception if the package could not be created.
Parameters:
  • dirname (string) - The directory in which the package is created.
Returns: Package
The package.

read_package(self, filename)

 
Reads the package with the given filename without installing it. Raises an exception if the package could not be read.
Parameters:
  • filename (string) - Path to the file containing the package.
Returns: Package
The package.

install_package(self, package)

 
Installs the given package. Raises an exception if the installation failed.
Parameters:
  • package (Package) - The package to install.
Returns: Package
The package.

remove_package(self, package)

 
Uninstalls the given package.
Parameters:
  • package (Package) - The package to remove.

remove_package_from_id(self, id)

 
Uninstalls the package with the given id.
Parameters:
  • id (int) - The id of the package to remove.

get_package_list(self, offset=0, limit=0, **kwargs)

 
Returns a list of all installed packages.
Parameters:
  • offset (int) - The number of packages to skip.
  • limit (int) - The maximum number of packages returned.
  • kwargs (dict) - The following keywords are accepted:
    • id: The id of the package.
    • depends: A package on which the returned package depends.
Returns: list[Package]
The list of packages.

get_listeners(self, uri)

 
Returns a list of all packages that are subscribed to the signal with the given URI.
Parameters:
  • uri (string) - The URI of the signal.
Returns: list[Package]
The list of packages.

get_package_from_descriptor(self, descriptor)

 
Returns the Package object that matches the given descriptor. If multiple versions match, the most recent version is returned.
Parameters:
  • descriptor (string) - A descriptor (e.g. "my_package>=1.0").
Returns: Package
The Package, or None if none was found.

get_package_from_name(self, name)

 
Returns the Package object with the given name. If multiple versions exist, the most recent version is returned.
Parameters:
  • name (string) - The name of the package.
Returns: Package
The Package, or None if none was found.

get_package_from_instance(self, instance)

 
Given an instance of the loaded package, this function returns the corresponding Package object.
Parameters:
  • instance (object) - The instance of the package.
Returns: Package
The corresponding Package if it exists, None otherwise.