Module pluginconf.depends
Dependency validation and consistency checker for updates
Classes
class Check (add=None, core=['st2', 'uikit', 'config', 'action'])
-
Now this definitely requires customization. Each plugin can carry a list of (soft-) dependency names.
… # depends: config, appcore >= 2.0, bin:wkhtmltoimage, python < 3.5
Here only in-application modules are honored, system references ignored. Unknown plugin names are also skipped. A real install helper might want to auto-tick them on, etc. This example is just meant for probing downloadable plugins.
The .valid() helper only asserts the api: string, or skips existing modules, and if they're more recent. While .depends() compares minimum versions against existing modules.
In practice there's little need for full-blown dependency resolving for application-level modules.
Attributes api list allowed api: identifiers for .valid() stream checks system_deps bool check bin:app
orpython:package
dependencieslog logging warning handler have dict accumulated list of existing/virtual plugins Prepare list of known plugins and versions in self.have={}
Parameters add dict name→pmd of existing/core plugins (incl ver or deps) core list name list of virtual plugins Class variables
var api
var log
var system_deps
Methods
def and_or(self, deps, have, inner_true=True)
-
Compare nested structure of [[dep],[alt,alt]]
def cmp(self, name_op_ver, have, absent=True)
-
Single comparison
def depends(self, plugin)
-
Verify depends: and breaks: against existing plugins/modules
Parameters plugin dict plugin meta properties of (new?) plugin Returns bool matches up with existing .have{} installation def module_test(self, urn, name)
-
Probes "bin:name" or "python:name" dependency URNs
def neither(self, deps, have)
-
Breaks/Conflicts: check [[or],[or]]
def split(self, dep_str)
-
Split trivial "pkg | alt, mod>=1, uikit<4.0" string into nested list [ [alt, alt], [dep], [dep] ]; with each entry comprised of (name, operator, version).
def valid(self, new_plugin)
-
Plugin pre-screening from online repository stream. Fields are $name, $file, $dist, api, id, depends, etc Exclude installed or for newer-version presence.
Parameters new_plugin dict online properties of available plugin Returns bool is updatatable