plainbox:i18n: remove expensive logging on dgettext

This patch removes leftover logging from dgettext() which is called far
too often to have logging enabled.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:secure:plugins: add some type annotations

This patch adds a few type annotations to the various plugin classes.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:secure:plugins: don't sort lazy mapping

This patch changes LazyPlugInCollection not to sort its lazy data
mapping in do_discover().

This breaks the previous assumption that data is provided in sorted
order but is actually a little bit better as now applications can decide
on what they want to do. Should an application want to observe a given,
fixed, order, it can now use an ordered dictionary as the input to the
plugin collection. Should it want sorted result it can use a regular
dictionary along with sort() around the places where it enumerates
plugins.

In effect, this allows us to use the lazy plugin collection as a way to
store commands that were previously hard-coded in a fixed order.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:secure:plugins: override LazyPlugInCollection.discovery_time

This patch allows to access the discovery_time property on a
LazyPlugInCollection before discovery is complete.

This is only natural as the lazy plugin collection is often used in a
lazy (non-complete, on-demand) loading scenarios. The problem is that
generic parts of plugin handling code might access the discovery_time
property (for reporting) and would get an AttributeError before
discovery was complete.

This patch removes the check and simply returns zero before discovery is
really complete.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:clitools: bump copyright

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:clitools: add unused early_ns=None to .add_subcommands()

This patch adds the optional and unused early_ns argument to
ToolBase.add_subcommands() and SingleCommandToolMixIn, in anticipation
of the upcoming API change.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:provider_manager: add unused early_ns=None to .add_subcommands()

This patch adds the optional and unused early_ns argument to
ProviderManagerTool.add_subcommands() in anticipation of upcoming API
change.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:provider_manager: add unused early_ns=None to .construct_parser()

This patch adds the optional and unused early_ns argument to
ToolBase.construct_parser() and
SingleCommandToolMixIn.construct_parser() in anticipation of the
upcoming API change.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:box: bump copyright

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:box: add unused early_ns=None to .add_subcommands()

This patch adds the optional and unused early_ns argument to
PlainBoxTool.add_subcommands() in anticipation of the upcoming API
change.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
checkbox-ng:tools: add unused early_ns=None to .add_subcommands()

This patch adds the optional and unused early_ns argument to
CheckboxTool.add_subcommands() in anticipation of the upcoming API
change.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:clitools: pass real early_ns to {construct_parser,add_subcommands}

This patch changes ToolBase.main() to pass the early_ns argument (which
contains the results of simplified parsing of command line arguments) to
ToolBase.construct_parser() and later to ToolBase.add_subcommands()

This completely sets the stage for the upcoming hinting API, where
add_subcommands can optimize the process and load only a fraction of the
available commands knowing in advance which command will be executed.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:clitools: fix PEP-8 issue

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:clitools: add LazyLoadingToolMixIn

This patch adds a new mix-in for the ToolBase, the abstract base class
for writing command line tools, which is using a hint-based optimization
when loading and registering commands for better responsiveness.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:box: load commands lazily

This patch changes the PlainBoxTool class to use the
LazyLoadingToolMixIn class. This allows ``plainbox cmd`` to be much more
responsive as it no longer has to load any additional commands, apart
from ``cmd`` itself.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
"automatic merge of lp:~zkrynicki/checkbox/lazy-commands/ by tarmac [r=sylvain-pineau][bug=][author=zkrynicki]"