From 39828d3ccc696c35ae9b4242c7a87604c86b9c4d Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Wed, 7 Sep 2016 07:52:26 -0700 Subject: [PATCH] bitbake: bitbake-user-manual: New section on functions you can call from Python Fixes [YOCTO #10100] I added a new parent directory named "Functions You Can Call From Within Python". This section contains a couple new sub-sections. One is the existing "Functions for Accessing Datastore Variables". The other is called "Other Functions", and it is used to point or reference some commonly used functions that the user can call from within Python. (Bitbake rev: ecbcedd74125ef00599f4af384ee303dae8af5b7) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../bitbake-user-manual-metadata.xml | 212 ++++++++++-------- 1 file changed, 120 insertions(+), 92 deletions(-) diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml index d4f73ae145..dcb1f1e3cf 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml @@ -1228,7 +1228,7 @@ For methods you can use with anonymous Python functions, see the - "Accessing Datastore Variables Using Python" + "Functions You Can Call From Within Python" section. For a different method to run Python code during parsing, see the @@ -2082,102 +2082,130 @@ -
- Accessing Datastore Variables Using Python +
+ Functions You Can Call From Within Python - It is often necessary to access variables in the - BitBake datastore using Python functions. - The Bitbake datastore has an API that allows you this - access. - Here is a list of available operations: + BitBake provides many functions you can call from + within Python functions. + This section lists the most commonly used functions, + and mentions where to find others. - - - - - - - - Operation - Description - - - - - d.getVar("X", expand) - Returns the value of variable "X". - Using "expand=True" expands the value. - - - d.setVar("X", "value") - Sets the variable "X" to "value". - - - d.appendVar("X", "value") - Adds "value" to the end of the variable "X". - - - d.prependVar("X", "value") - Adds "value" to the start of the variable "X". - - - d.delVar("X") - Deletes the variable "X" from the datastore. - - - d.renameVar("X", "Y") - Renames the variable "X" to "Y". - - - d.getVarFlag("X", flag, expand) - Returns the value of variable "X". +
+ Functions for Accessing Datastore Variables + + + It is often necessary to access variables in the + BitBake datastore using Python functions. + The Bitbake datastore has an API that allows you this + access. + Here is a list of available operations: + + + + + + + + + + Operation + Description + + + + + d.getVar("X", expand) + Returns the value of variable "X". Using "expand=True" expands the value. - - - d.setVarFlag("X", flag, "value") - Sets the named flag for variable "X" to "value". - - - d.appendVarFlag("X", flag, "value") - Appends "value" to the named flag on the - variable "X". - - - d.prependVarFlag("X", flag, "value") - Prepends "value" to the named flag on - the variable "X". - - - d.delVarFlag("X", flag) - Deletes the named flag on the variable - "X" from the datastore. - - - d.setVarFlags("X", flagsdict) - Sets the flags specified in - the flagsdict() parameter. - setVarFlags does not clear previous flags. - Think of this operation as addVarFlags. - - - d.getVarFlags("X") - Returns a flagsdict of the flags for - the variable "X". - - - d.delVarFlags("X") - Deletes all the flags for the variable "X". - - - d.expand(expression) - Expands variable references in the specified string expression. - - - - - + + + d.setVar("X", "value") + Sets the variable "X" to "value". + + + d.appendVar("X", "value") + Adds "value" to the end of the variable "X". + + + d.prependVar("X", "value") + Adds "value" to the start of the variable "X". + + + d.delVar("X") + Deletes the variable "X" from the datastore. + + + d.renameVar("X", "Y") + Renames the variable "X" to "Y". + + + d.getVarFlag("X", flag, expand) + Returns the value of variable "X". + Using "expand=True" expands the value. + + + d.setVarFlag("X", flag, "value") + Sets the named flag for variable "X" to "value". + + + d.appendVarFlag("X", flag, "value") + Appends "value" to the named flag on the + variable "X". + + + d.prependVarFlag("X", flag, "value") + Prepends "value" to the named flag on + the variable "X". + + + d.delVarFlag("X", flag) + Deletes the named flag on the variable + "X" from the datastore. + + + d.setVarFlags("X", flagsdict) + Sets the flags specified in + the flagsdict() parameter. + setVarFlags does not clear previous flags. + Think of this operation as addVarFlags. + + + d.getVarFlags("X") + Returns a flagsdict of the flags for + the variable "X". + + + d.delVarFlags("X") + Deletes all the flags for the variable "X". + + + d.expand(expression) + Expands variable references in the specified string expression. + + + + + +
+ +
+ Other Functions + + + You can find many other functions that can be called + from Python by looking at the source code of the + bb module, which is in + bitbake/lib/bb. + For example, + bitbake/lib/bb/utils.py includes + the commonly used functions + bb.utils.contains() and + bb.utils.mkdirhier(), which come + with docstrings. + +