Skip to contentSkip to conversation

doc/bitbake-user-manual-metadata.rst: fix python task example

PATCH New Antonin Godard 1 participant 1 message Apr 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc/bitbake-user-manual-metadata.rst: fix python task example

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]

---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +2 -2
index 415fbf6d6..db1749178 100644
@@ -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
 

---
base-commit: 136c06e251de68ed64355ec6b47a522ff3a372e3
change-id: 20250404-fix-python-task-example-de3508554c22

Best regards,

Signature · 1 line
Antonin Godard <[email protected]>