| Message ID | 20260501091418.76994-3-bijak.dawid@gmail.com |
|---|---|
| State | Accepted, archived |
| Commit | 9339d93adfd10b7b66daa1d55140f36aff71367a |
| Headers | show |
| Series | doc: bitbake-user-manual-metadata: clarify inherit_defer documentation | expand |
Hi Dawid, On 5/1/26 11:14 AM, Dawid Bijak wrote: > The documentation for inherit_defer suggested that conditional inheritance > can be achieved by setting a variable inside an anonymous python function > and then referencing it from inherit_defer. > This does not work: inherit_defer is resolved before the anonymous Python > functions run. > > Remove the incorrect example. > That's fine, but this is so far an undocumented limitation and it would be really nice to say it's not supported! Something like: .. warning:: Setting or modifying variables within an :ref:`anonymous Python function <bitbake-user-manual/bitbake-user-manual-metadata:Anonymous Python Functions>` will have no impact on the value of that variable in an :ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>` directive as the function is run after the directive is resolved. (untested and probably missing some formatting, e.g. line-wrapping :) ). Cheers, Quentin
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index ee6919dc4..b886e0578 100644 --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst @@ -835,17 +835,6 @@ overrides:: VARIABLE = "" VARIABLE:someoverride = "myclass" -Another method is by using :ref:`anonymous Python -<bitbake-user-manual/bitbake-user-manual-metadata:Anonymous Python Functions>`. -Here is an example:: - - python () { - if condition == value: - d.setVar('VARIABLE', 'myclass') - else: - d.setVar('VARIABLE', '') - } - Alternatively, you could use an inline Python expression in the following form::
The documentation for inherit_defer suggested that conditional inheritance can be achieved by setting a variable inside an anonymous python function and then referencing it from inherit_defer. This does not work: inherit_defer is resolved before the anonymous Python functions run. Remove the incorrect example. Signed-off-by: Dawid Bijak <bijak.dawid@gmail.com> --- .../bitbake-user-manual-metadata.rst | 11 ----------- 1 file changed, 11 deletions(-)