Message ID | 20250404-fix-python-task-example-v1-1-65f831cda2cd@bootlin.com |
---|---|
State | Not Applicable |
Headers | show |
Series | doc/bitbake-user-manual-metadata.rst: fix python task example | expand |
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index 415fbf6d6..db1749178 100644 --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst @@ -1405,8 +1405,8 @@ the task and other tasks. Here is an example that shows how to define a task and declare some dependencies:: python do_printdate () { - import time - print time.strftime('%Y%m%d', time.gmtime()) + import datetime + bb.plain('Date: %s' % (datetime.date.today())) } addtask printdate after do_fetch before do_build
Fix the old Python 2 print statement, replace it by a bb.plain() call instead. Also replace time by datetime for a slightly simpler example. [YOCTO #14670] Reported-by: Robert Berger <pokylinux@reliableembeddedsystems.com> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- base-commit: 136c06e251de68ed64355ec6b47a522ff3a372e3 change-id: 20250404-fix-python-task-example-de3508554c22 Best regards,