public inbox for docs@lists.yoctoproject.org
 help / color / mirror / Atom feed
From: Antonin Godard <antonin.godard@bootlin.com>
To: bitbake-devel@lists.openembedded.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 docs@lists.yoctoproject.org,
	 Robert Berger <pokylinux@reliableembeddedsystems.com>,
	 Antonin Godard <antonin.godard@bootlin.com>
Subject: [PATCH] doc/bitbake-user-manual-metadata.rst: fix python task example
Date: Fri, 04 Apr 2025 17:17:56 +0200	[thread overview]
Message-ID: <20250404-fix-python-task-example-v1-1-65f831cda2cd@bootlin.com> (raw)

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(-)

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
 

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

Best regards,
-- 
Antonin Godard <antonin.godard@bootlin.com>



                 reply	other threads:[~2025-04-04 15:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250404-fix-python-task-example-v1-1-65f831cda2cd@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=pokylinux@reliableembeddedsystems.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox