diff options
| -rw-r--r-- | bitbake/doc/user-manual/user-manual-metadata.xml | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/bitbake/doc/user-manual/user-manual-metadata.xml b/bitbake/doc/user-manual/user-manual-metadata.xml index 53f677e2f3..23b3fa67d3 100644 --- a/bitbake/doc/user-manual/user-manual-metadata.xml +++ b/bitbake/doc/user-manual/user-manual-metadata.xml | |||
| @@ -741,4 +741,73 @@ python do_printdate () { | |||
| 741 | </para> | 741 | </para> |
| 742 | </section> | 742 | </section> |
| 743 | </section> | 743 | </section> |
| 744 | |||
| 745 | <section id='accessing-variables-and-the-data-store-from-python'> | ||
| 746 | <title>Accessing Variables and the Data Store from Python</title> | ||
| 747 | |||
| 748 | <para> | ||
| 749 | It is often necessary to manipulate variables within python functions | ||
| 750 | and the Bitbake data store has an API which allows this. | ||
| 751 | The operations available are: | ||
| 752 | <literallayout class='monospaced'> | ||
| 753 | d.getVar("X", expand=False) | ||
| 754 | </literallayout> | ||
| 755 | returns the value of variable "X", expanding the value | ||
| 756 | if specified. | ||
| 757 | <literallayout class='monospaced'> | ||
| 758 | d.setVar("X", value) | ||
| 759 | </literallayout> | ||
| 760 | sets the value of "X" to "value". | ||
| 761 | <literallayout class='monospaced'> | ||
| 762 | d.appendVar("X", value) | ||
| 763 | </literallayout> | ||
| 764 | adds "value" to the end of variable X. | ||
| 765 | <literallayout class='monospaced'> | ||
| 766 | d.prependVar("X", value) | ||
| 767 | </literallayout> | ||
| 768 | adds "value" to the start of variable X. | ||
| 769 | <literallayout class='monospaced'> | ||
| 770 | d.delVar("X") | ||
| 771 | </literallayout> | ||
| 772 | deletes the variable X from the data store. | ||
| 773 | <literallayout class='monospaced'> | ||
| 774 | d.renameVar("X", "Y") | ||
| 775 | </literallayout> | ||
| 776 | renames variable X to Y. | ||
| 777 | <literallayout class='monospaced'> | ||
| 778 | d.getVarFlag("X", flag, expand=False) | ||
| 779 | </literallayout> | ||
| 780 | gets given flag from variable X but does not expand it. | ||
| 781 | <literallayout class='monospaced'> | ||
| 782 | d.setVarFlag("X", flag, value) | ||
| 783 | </literallayout> | ||
| 784 | sets given flag for variable X to value. | ||
| 785 | <filename>setVarFlags</filename> will not clear previous flags. | ||
| 786 | Think of this method as <filename>addVarFlags</filename>. | ||
| 787 | <literallayout class='monospaced'> | ||
| 788 | d.appendVarFlag("X", flag, value) | ||
| 789 | </literallayout> | ||
| 790 | Need description. | ||
| 791 | <literallayout class='monospaced'> | ||
| 792 | d.prependVarFlag("X", flag, value) | ||
| 793 | </literallayout> | ||
| 794 | Need description. | ||
| 795 | <literallayout class='monospaced'> | ||
| 796 | d.delVarFlag("X", flag) | ||
| 797 | </literallayout> | ||
| 798 | Need description. | ||
| 799 | <literallayout class='monospaced'> | ||
| 800 | d.setVarFlags("X", flagsdict) | ||
| 801 | </literallayout> | ||
| 802 | sets the flags specified in the <filename>dict()</filename> parameter. | ||
| 803 | <literallayout class='monospaced'> | ||
| 804 | d.getVarFlags("X") | ||
| 805 | </literallayout> | ||
| 806 | returns a <filename>dict</filename> of the flags for X. | ||
| 807 | <literallayout class='monospaced'> | ||
| 808 | d.delVarFlags | ||
| 809 | </literallayout> | ||
| 810 | deletes all the flags for a variable. | ||
| 811 | </para> | ||
| 812 | </section> | ||
| 744 | </chapter> | 813 | </chapter> |
