On Tue, 2026-02-24 at 10:10 +0100, Benjamin Robin via lists.openembedded.org 
wrote:
> On Monday, February 23, 2026 at 6:43 PM, Joshua Watt wrote:
> > I like this in general, but if you're going to bbappend, the `return`
> > will mess with any other appends, so it needs to be avoided. Probably
> > just put all the code under a
> > `if bb.data.inherits_class("create-spdx-3.0", d):` instead
> 
> Indeed, thank you for your feedback.
> My initial plan was to move all code inside a Python function named
> create_kernel_config_spdx, and to call this function from 
> do_create_spdx:append().
> 
> Sadly, the generated code looks like this:
> ```
> def do_create_spdx(d):
>     import oe.spdx30_tasks
>     oe.spdx30_tasks.create_spdx(d)
>     create_kernel_config_spdx()
> 
> do_create_spdx(d)
> 
> def create_kernel_config_spdx(d):
>     # Code of the function
> ```
> 
> This is not going to work, since the create_kernel_config_spdx() is declared 
> after the call to do_create_spdx().
> 
> From my point of view, there is a bug in bitbake code : The 
> emit_func_python() 
> function  declared in lib/bb/data.py does not generate code in the right 
> order: The "write_func(func, o, True)" should be called at the end of
> emit_func_python().
> I am missing something, or is there any reason why emit_func_python() is 
> implemented that way?
> 
> Anyway I am preparing a v3, that solve this issue differently.

I think it would work as the emit_python_func code generates code for
debugging, it isn't what is actually run. What actually happens is all
the python functions are compiled and then called within the current
python execution environment.

Improving emit_func_python() to be more accurate is something I've
wanted to do for a while as the data store is missing, as is most of
the fakeroot execution environment that the shell/python tasks
sometimes use too.

Cheers,

Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#231753): 
https://lists.openembedded.org/g/openembedded-core/message/231753
Mute This Topic: https://lists.openembedded.org/mt/117836081/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to