Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Dawid Bijak <bijak.dawid@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org, quentin.schulz@cherry.de,
	richard.purdie@linuxfoundation.org,
	Dawid Bijak <bijak.dawid@gmail.com>
Subject: [PATCH v2 4/4] doc: bitbake-user-manual-metadata: move inline python examples to inherit section
Date: Fri,  1 May 2026 11:14:18 +0200	[thread overview]
Message-ID: <20260501091418.76994-5-bijak.dawid@gmail.com> (raw)
In-Reply-To: <20260501091418.76994-1-bijak.dawid@gmail.com>

The two inline Python examples,

  inherit_defer ${@'classname' if condition else ''}
  inherit_defer ${@bb.utils.contains('VARIABLE', 'something', 'classname', '', d)}

are presented as inherit_defer-specific techniques, but they work
with plain inherit too. Their placement under
inherit_defer suggests deferred evaluation is required, which is
not the case: the ${@...} expression is evaluated when the
inherit line is parsed in both forms.

Move the inline Python expression examples from the inherit_defer section
up to the inherit section, since they apply to both directives.

Signed-off-by: Dawid Bijak <bijak.dawid@gmail.com>
---
 .../bitbake-user-manual-metadata.rst          | 25 ++++++++-----------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index 0c7c3ff99..4b1aeedc1 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -803,7 +803,17 @@ An advantage with the inherit directive as compared to both the
 :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` and :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>`
 directives is that you can inherit class files conditionally. You can
 accomplish this by using a variable expression after the ``inherit``
-statement.
+statement, as in::
+
+   inherit ${@'classname' if condition else ''}
+
+Or::
+
+   inherit ${@bb.utils.contains('VARIABLE', 'something', 'classname', '', d)}
+
+In both cases, if the expression evaluates to an
+empty string, the statement does not trigger a syntax error because it
+becomes a no-op.
 
 For inheriting classes conditionally, using the :ref:`inherit_defer
 <ref-bitbake-user-manual-metadata-inherit-defer>` directive is advised as
@@ -840,19 +850,6 @@ defers the evaluation of ``${VARNAME}`` until the end of
 parsing. Assuming ``someoverride`` is in :term:`OVERRIDES`, ``${VARNAME}``
 expands to ``myclass``, which is then inherited.
 
-Alternatively, you could use an inline Python expression in the
-following form::
-
-   inherit_defer ${@'classname' if condition else ''}
-
-Or::
-
-   inherit_defer ${@bb.utils.contains('VARIABLE', 'something', 'classname', '', d)}
-
-In all cases, if the expression evaluates to an
-empty string, the statement does not trigger a syntax error because it
-becomes a no-op.
-
 See also :term:`BB_DEFER_BBCLASSES` for automatically promoting classes
 ``inherit`` calls to ``inherit_defer``.
 
-- 
2.48.1



  parent reply	other threads:[~2026-05-01  9:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01  9:14 [PATCH v2 0/4] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Dawid Bijak
2026-05-01  9:14 ` [PATCH v2 1/4] doc: bitbake-user-manual-metadata: remove incorrect claim Dawid Bijak
2026-05-07 13:48   ` Quentin Schulz
2026-05-07 19:04     ` Dawid Bijak
2026-05-01  9:14 ` [PATCH v2 2/4] doc: bitbake-user-manual-metadata: remove invalid anonymous Python example Dawid Bijak
2026-05-07 13:52   ` Quentin Schulz
2026-05-01  9:14 ` [PATCH v2 3/4] doc: bitbake-user-manual-metadata: explain inherit_defer example Dawid Bijak
2026-05-07 13:56   ` Quentin Schulz
2026-05-01  9:14 ` Dawid Bijak [this message]
2026-05-07 14:05   ` [PATCH v2 4/4] doc: bitbake-user-manual-metadata: move inline python examples to inherit section Quentin Schulz

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=20260501091418.76994-5-bijak.dawid@gmail.com \
    --to=bijak.dawid@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=quentin.schulz@cherry.de \
    --cc=richard.purdie@linuxfoundation.org \
    /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