diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-07-19 11:56:09 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-21 08:41:12 +0100 |
commit | 2b5c3617c2779d7b13afe91bcc07f8b6057be1e7 (patch) | |
tree | 18adabe54e8c8a0ea6382c7cded782c67a91b992 /bitbake/lib/bb/tinfoil.py | |
parent | 388ae704bbd5116cfba517177b109fb18377f0e2 (diff) | |
download | openembedded-core-contrib-2b5c3617c2779d7b13afe91bcc07f8b6057be1e7.tar.gz |
bitbake: tinfoil: add more doc comments
We want this API to be easier to use, so add missing function
documentation to help with that.
(Bitbake rev: 3e0e002d6497caa987f327cd83ad4db82cca6810)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tinfoil.py')
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 30d6c9af3e..e246b3d2a2 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py @@ -55,6 +55,7 @@ class TinfoilCommandFailed(Exception): """Exception raised when run_command fails""" class TinfoilDataStoreConnector: + """Connector object used to enable access to datastore objects via tinfoil""" def __init__(self, tinfoil, dsindex): self.tinfoil = tinfoil @@ -294,8 +295,25 @@ class TinfoilRecipeInfo: class Tinfoil: + """ + Tinfoil - an API for scripts and utilities to query + BitBake internals and perform build operations. + """ def __init__(self, output=sys.stdout, tracking=False, setup_logging=True): + """ + Create a new tinfoil object. + Parameters: + output: specifies where console output should be sent. Defaults + to sys.stdout. + tracking: True to enable variable history tracking, False to + disable it (default). Enabling this has a minor + performance impact so typically it isn't enabled + unless you need to query variable history. + setup_logging: True to setup a logger so that things like + bb.warn() will work immediately and timeout warnings + are visible; False to let BitBake do this itself. + """ self.logger = logging.getLogger('BitBake') self.config_data = None self.cooker = None @@ -316,6 +334,37 @@ class Tinfoil: self.shutdown() def prepare(self, config_only=False, config_params=None, quiet=0, extra_features=None): + """ + Prepares the underlying BitBake system to be used via tinfoil. + This function must be called prior to calling any of the other + functions in the API. + NOTE: if you call prepare() you must absolutely call shutdown() + before your code terminates. You can use a "with" block to ensure + this happens e.g. + + with bb.tinfoil.Tinfoil() as tinfoil: + tinfoil.prepare() + ... + + Parameters: + config_only: True to read only the configuration and not load + the cache / parse recipes. This is useful if you just + want to query the value of a variable at the global + level or you want to do anything else that doesn't + involve knowing anything about the recipes in the + current configuration. False loads the cache / parses + recipes. + config_params: optionally specify your own configuration + parameters. If not specified an instance of + TinfoilConfigParameters will be created internally. + quiet: quiet level controlling console output - equivalent + to bitbake's -q/--quiet option. Default of 0 gives + the same output level as normal bitbake execution. + extra_features: extra features to be added to the feature + set requested from the server. See + CookerFeatures._feature_list for possible + features. + """ self.quiet = quiet if self.tracking: @@ -440,9 +489,16 @@ class Tinfoil: return self.server_connection.events.waitEvent(timeout) def get_overlayed_recipes(self): + """ + Find recipes which are overlayed (i.e. where recipes exist in multiple layers) + """ return defaultdict(list, self.run_command('getOverlayedRecipes')) def get_skipped_recipes(self): + """ + Find recipes which were skipped (i.e. SkipRecipe was raised + during parsing). + """ return OrderedDict(self.run_command('getSkippedRecipes')) def get_all_providers(self): @@ -475,6 +531,9 @@ class Tinfoil: return best[3] def get_file_appends(self, fn): + """ + Find the bbappends for a recipe file + """ return self.run_command('getFileAppends', fn) def all_recipes(self, mc='', sort=True): @@ -739,6 +798,12 @@ class Tinfoil: return ret def shutdown(self): + """ + Shut down tinfoil. Disconnects from the server and gracefully + releases any associated resources. You must call this function if + prepare() has been called, or use a with... block when you create + the tinfoil object which will ensure that it gets called. + """ if self.server_connection: self.run_command('clientComplete') _server_connections.remove(self.server_connection) |