diff options
author | Paul Eggleton <bluelightning@bluelightning.org> | 2023-04-22 15:05:22 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-04-22 10:29:49 +0100 |
commit | 1b74a7b71e6c8a034163b57ef4e13b4a58c1f844 (patch) | |
tree | 3c0923cb6d9918b7e8aba65f53f44f5574a6f1aa | |
parent | fa91e1a02240be1f7b78ef70953ff4a0e0106cc2 (diff) | |
download | bitbake-contrib-1b74a7b71e6c8a034163b57ef4e13b4a58c1f844.tar.gz |
bitbake-user-manual: add addpylib and BB_GLOBAL_PYMODULES
New directive and variable for 2.4.
Signed-off-by: Paul Eggleton <bluelightning@bluelightning.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 18 | ||||
-rw-r--r-- | doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | 8 |
2 files changed, 26 insertions, 0 deletions
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index ba8129afa..b35c332c8 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 1cf37d5fc..fc7cb8823 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. |