From: Paul Eggleton <bluelightning@bluelightning.org>
To: bitbake-devel@lists.openembedded.org
Cc: michael.opdenacker@bootlin.com
Subject: [PATCH 2/3] bitbake-user-manual: add addpylib and BB_GLOBAL_PYMODULES
Date: Sat, 22 Apr 2023 15:05:22 +1200 [thread overview]
Message-ID: <577da6f51365daf0f04b21db1914044e617e6c63.1682131637.git.bluelightning@bluelightning.org> (raw)
In-Reply-To: <cover.1682131637.git.bluelightning@bluelightning.org>
New directive and variable for 2.4.
Signed-off-by: Paul Eggleton <bluelightning@bluelightning.org>
---
.../bitbake-user-manual-metadata.rst | 18 ++++++++++++++++++
.../bitbake-user-manual-ref-variables.rst | 8 ++++++++
2 files changed, 26 insertions(+)
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index ba8129afab..b35c332c82 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -1972,6 +1972,24 @@ looking at the source code of the ``bb`` module, which is in
the commonly used functions ``bb.utils.contains()`` and
``bb.utils.mkdirhier()``, which come with docstrings.
+Extending Python Library Code
+-----------------------------
+
+If you wish to add your own Python library code (e.g. to provide
+functions/classes you can use from Python functions in the metadata)
+you can do so from any layer using the ``addpylib`` directive.
+This directive is typically added to your layer configuration (
+``conf/layer.conf``) although it will be handled in any ``.conf`` file.
+
+Usage is of the form::
+
+ addpylib <directory> <namespace>
+
+Where <directory> specifies the directory to add to the library path.
+The specified <namespace> is imported automatically, and if the imported
+module specifies an attribute named ``BBIMPORTS``, that list of
+sub-modules is iterated and imported too.
+
Testing and Debugging BitBake Python code
-----------------------------------------
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
index 1cf37d5fcd..fc7cb88238 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
@@ -348,6 +348,14 @@ overview of their function and contents.
For example usage, see :term:`BB_GIT_SHALLOW`.
+ :term:`BB_GLOBAL_PYMODULES`
+ Specifies the list of Python modules to place in the global namespace.
+ It is intended that only the core layer should set this and it is meant
+ to be a very small list, typically just ``os`` and ``sys``.
+ :term:`BB_GLOBAL_PYMODULES` is expected to be set before the first
+ ``addpylib`` directive.
+ See also ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:extending python library code`".
+
:term:`BB_HASHCHECK_FUNCTION`
Specifies the name of the function to call during the "setscene" part
of the task's execution in order to validate the list of task hashes.
--
2.34.1
next prev parent reply other threads:[~2023-04-22 3:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-22 3:05 [PATCH 0/3] BitBake user manual updates for 2.4 Paul Eggleton
2023-04-22 3:05 ` [PATCH 1/3] bitbake-user-manual: document BB_CACHEDIR Paul Eggleton
2023-04-22 3:05 ` Paul Eggleton [this message]
2023-04-22 3:05 ` [PATCH 3/3] bitbake-user-manual: add BB_HASH_CODEPARSER_VALS Paul Eggleton
2023-04-22 9:33 ` [bitbake-devel] [PATCH 0/3] BitBake user manual updates for 2.4 Richard Purdie
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=577da6f51365daf0f04b21db1914044e617e6c63.1682131637.git.bluelightning@bluelightning.org \
--to=bluelightning@bluelightning.org \
--cc=bitbake-devel@lists.openembedded.org \
--cc=michael.opdenacker@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;
as well as URLs for NNTP newsgroup(s).