summaryrefslogtreecommitdiffstats
path: root/plugin_registry.py
Commit message (Collapse)AuthorAgeFilesLines
* plugin_registry: more systemic builtin plugin paths injectionJan Pokorný2015-08-111-8/+7
| | | | | | | Now, the injection can be prevented by either specifying paths as None or by initial item in the non-empty iterable being None. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* utils: try avoiding clash of special keys in kwargsJan Pokorný2015-08-111-1/+1
| | | | | | | | ...in filterdict_* lambdas where (now) _fn_ is a special key. Also adjust the callers where needed. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Better support of Composite format usage/passingJan Pokorný2015-04-151-2/+3
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Mass change: import logging -> from logging import getLoggerJan Pokorný2015-01-091-2/+2
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: (std) error on module load is non-fatalJan Pokorný2014-12-081-0/+4
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: abandon "relative to project root plugindir"Jan Pokorný2014-11-241-1/+1
| | | | | | ... use "relative to CWD" instead Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Extend external plugins support: user provided dirsJan Pokorný2014-11-241-5/+16
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Add support for external plugins (located in ext-plugins subdir)Jan Pokorný2014-11-241-5/+20
| | | | | | | Alternatively, in development mode, it is useful to override it using {PREFIX}_EXTPLUGINS env. variable. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: allow loading dir/__init__.py as wellJan Pokorný2014-11-141-10/+15
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: sanitize kwargs passing in init_lookupJan Pokorný2014-11-141-2/+2
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: better approach in PluginManager.lookupJan Pokorný2014-11-141-4/+4
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: also this discovery skips '[.]*' filesJan Pokorný2014-09-221-1/+1
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: fix overly keen (nested) plugin discoveryJan Pokorný2014-09-221-0/+2
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: drop unused class attributeJan Pokorný2014-09-171-1/+0
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: fix issue with non-discoverable pluginsJan Pokorný2014-09-171-8/+24
| | | | | | | | | | | | | | | | | | There are "native" plugins, such as XML under `format` module. The problem with these is that once they are dropped (`PluginRegistry.setup(reset=True)`), they cannot be re-discovered any more (the first discovery is usually implicit through the import + metaclass machinery). Now we can also remove a hack in `PluginRegistry.discovery()` that used to inject such "native" plugins implicitly (but till the whole registry got restarted!) if full search was requested. Thanks to Travis CI for exposing the issue because of the different ordering of the unit tests (subsequently reproduced at me with `./run-tests tests.{format_manager.Injection,command_manager.Default}`). Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: extend logging for default _init_pluginsJan Pokorný2014-09-171-1/+2
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: optimization + id enforcement (for tests)Jan Pokorný2014-09-091-9/+14
| | | | | | | | | | | | | | When plugin in question is not tracked yet, but is found in the dedicated namespace module (as per module:symbol convention), it is sucked from here rather than applying whole "probe" cycle resulting in duplicated classes (which should rather be treated as singletons, anyway). Possible thanks to 5ed999651ec89bfbc1ab1e8283b40ae2476a02da that introduced that convention (oh well, which should rather be enforced programatically). Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: do not return when exception bubbles upJan Pokorný2014-09-091-1/+1
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: dedicated method for "make namespaced symbol"Jan Pokorný2014-09-091-1/+5
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: fix always-true misuse of assert stmtJan Pokorný2014-09-091-2/+2
| | | | | | | | | | Apparently, comma-separated values -> tuple is preceded with assert statement syntactic closure recognition, hence pair of arguments to assert cannot be enclosed with parentheses (previous assumption was that it is the same due to syntactically both notations are equivalent). Reported-by: Tomáš Jelínek" <tojelinek@redhat.com> Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Make CLI interface work again after bfbb5c8(?)Jan Pokorný2014-09-051-4/+6
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: sanitizeJan Pokorný2014-09-051-1/+5
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: lib-use-convenience/pick what's neededJan Pokorný2014-09-051-8/+41
| | | | | | | | PluginManager now has an ability to selectively get and initiliaze only selected plugin(s). What remains to be done is a propagation of this principle in the commands - filters - formats chain. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: do not hardcode '.py' (can be derived)Jan Pokorný2014-09-051-4/+5
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: unify passing of look-aside pluginsJan Pokorný2014-09-051-1/+1
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: prefer specific imports from impJan Pokorný2014-09-051-3/+3
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: simplify singular-plural arg handlingJan Pokorný2014-09-051-7/+8
| | | | | | ...using primitives from utils.py Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: s/_init_handle_plugins/_init_pluginsJan Pokorný2014-09-051-5/+5
| | | | | | + add a note that we could somehow initialize plugins earlier Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Solve a "read-only dict as API" question once foreverJan Pokorný2014-09-041-18/+19
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* format: fix multiple class-level __init__ per one __new__ resultJan Pokorný2014-09-031-0/+3
| | | | | | | + modify tests/run_cmd to trigger such a case Reported-by: Tomáš Jelínek" <tojelinek@redhat.com> Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry vs. protocol(s): "kludge" -> fixed featureJan Pokorný2014-09-011-3/+5
| | | | | | | | | | | | | | | | | | In fact, commit 8dd14ec29fe829e9edf0102e45966a4a1cc012d7 commented out what was intentionally present to prevent RuntimeWarning due to importing discovered plugins to the yet non-existent module namespace (missing parent) in case the respective registry hadn't been imported in advance. That commit tried to solve a conflict with protol.py, which referred to "clufter.plugins" module namespace, but unlike the previous registries (formats, filters, commands), "plugins" is not backed by a real module (i.e., neither plugins.py nor plugins/__init__.py exist at the top level). Solution is simple, make protocols registry set the namespace as a non-value, which is then considered a signal not to attempt any such for-the-sake-of-sanity complementary import. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry/commands: implement+use RO view on pluginsJan Pokorný2014-08-291-0/+18
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* (Optionally) promote protocols to first-class entityJan Pokorný2014-08-291-4/+6
| | | | | | | | | | | | + reflect that on the formats' level (also bring a convention for that) + make plugin_registry.probe fnc more tolerant towards non-classes as we want to differentiate between protocol on instance basis rather than based on dedicated classes (because we want to pragmatically maintain interchangeability with plain strings!) + make extra steps in protocol.py so the mentioned interchangeability actually works Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: comment out kludge that become harmfull(?)Jan Pokorný2014-08-291-3/+3
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* utils_prog: new program-specific unit incl. some moves from utilsJan Pokorný2014-05-191-1/+2
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Relicence GPLv2 -> GPLv2+Jan Pokorný2014-04-251-1/+1
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Formalize s/_/-/g + inverse transformation as functionsJan Pokorný2014-03-061-2/+2
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry: all string identifiers use '-' instead of '_'Jan Pokorný2014-03-041-0/+2
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* plugin_registry/format/filter: new way of "private plugin" markingJan Pokorný2014-02-091-9/+9
| | | | | | | using MetaPlugin class in the inheritance hierarchy to mark this fact. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* *_manager: s/_handle_plugins/_init_handle_plugins/ + change guardJan Pokorný2014-01-211-2/+4
| | | | | | ... making a need to subclass PluginManager explicit Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* *Manager: make common (abstract) base PluginManagerJan Pokorný2014-01-171-0/+16
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Remove usage of "too forward" dict comprehensionsJan Pokorný2014-01-131-3/+3
| | | | | | Generators and list comprehensions should be OK in Python 2.6. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Batch header unificationJan Pokorný2013-11-181-1/+1
| | | | Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
* Initial commitJan Pokorný2013-11-181-0/+194
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>