Package zeroinstall :: Package injector :: Module solver :: Class Solver
[frames] | no frames]

Class Solver

source code

object --+
         |
        Solver

Chooses a set of implementations to satisfy the requirements of a program and its user. Typical use:

  1. Create a Solver object and configure it
  2. Call solve.
  3. If any of the returned feeds_used are stale or missing, you may like to start downloading them
  4. If it is 'ready' then you can download and run the chosen versions.
Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
solve_for(self, requirements)
Solve for given requirements.
source code
 
solve(self, root_interface, root_arch, command_name='run')
Get the best implementation of root_interface and all of its dependencies.
source code
architecture.Architecture
get_arch_for(self, requirements, interface=None)
Return the Architecture we would use when solving for this interface.
source code

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

Instance Variables
{str: [(Implementation, comment)]} details
extra information, if record_details mode was used
set(str) feeds_used
the feeds which contributed to the choice in selections
{Interface: [(Implementation, str)]} record_details
whether to record information about unselected implementations
{model.Interface: [model.Dependency]} requires
the selected dependencies for each chosen version
selections.Selections selections
the chosen implementation of each interface
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

solve_for(self, requirements)

source code 

Solve for given requirements.

Parameters:

Postcondition: self.ready, self.selections and self.feeds_used are updated

Since: 1.8

solve(self, root_interface, root_arch, command_name='run')

source code 

Get the best implementation of root_interface and all of its dependencies.

Parameters:
  • root_interface (str) - the URI of the program to be solved
  • root_arch (arch.Architecture) - the desired target architecture
  • command_name (str | None) - which <command> element to select

Postcondition: self.ready, self.selections and self.feeds_used are updated

get_arch_for(self, requirements, interface=None)

source code 

Return the Architecture we would use when solving for this interface. Normally, this architecture is constructed from the OS and CPU type in the requirements, using the host platform's settings if these are not given. If interface is the root, then we wrap this in a SourceArchitecture if looking for source code and (for backwards compatibility) we enable use="testing" dependencies if the command is "test".

Parameters:
Returns: architecture.Architecture
the architecture that would be used

Since: 1.9