entropy :: dep :: DependencyStringParser :: Class DependencyStringParser

Class DependencyStringParser

source code


Conditional dependency string parser. It is used by Entropy dependency matching logic to evaluate dependency conditions containing boolean operators. Example: "( app-foo/foo & foo-misc/foo ) | foo-misc/new-foo"

Example usage (self is an EntropyRepositoryBase instance): >>> parser = DependencyStringParser("app-foo/foo & foo-misc/foo", self) >>> matched, outcome = parser.parse() >>> matched True >>> outcome ["app-foo/foo", "foo-misc/foo"]

Nested Classes
  MalformedDependency
Raised when dependency string is malformed.
Instance Methods
 
__init__(self, entropy_dep, entropy_repository_list, selected_matches=None)
DependencyStringParser constructor.
source code
tuple
parse(self)
Execute the actual parsing and return the result.
source code

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

Class Variables
  LOGIC_AND = '&'
  LOGIC_OR = '|'
Properties

Inherited from object: __class__

Method Details

__init__(self, entropy_dep, entropy_repository_list, selected_matches=None)
(Constructor)

source code 

DependencyStringParser constructor.

Parameters:
  • entropy_dep (string) - the dependency string to parse
  • entropy_repository_list (list) - ordered list of EntropyRepositoryBase based instances
  • selected_matches (set) - if given, it will be used in the decisional process of selecting conditional dependencies. Generally, a list of selected matches comes directly from user packages selection.
Overrides: object.__init__

parse(self)

source code 

Execute the actual parsing and return the result.

Returns: tuple
tuple composed by boolean (matched? not matched?) and list of evaluated/matched dependencies.
Raises: