summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual/python-development-shell.rst
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2023-09-18 16:11:24 +0200
committerSteve Sakoman <steve@sakoman.com>2023-09-23 05:26:16 -1000
commit337a21080bdb50fa8726d8ed74a290190463dd5f (patch)
tree66c53d600108699bee608df0a154967ae5394e52 /documentation/dev-manual/python-development-shell.rst
parent90e943b8d1b76dac3b6d6822119ac6650efc90ba (diff)
downloadpoky-337a21080bdb50fa8726d8ed74a290190463dd5f.tar.gz
dev-manual: split common-tasks.rst
Reusing content from the master branch which underwent this change earlier. This change makes it much easier to backport manual updates to the kirkstone LTS branch. To make the change and future updates simpler, reused file contents from master, only excluding changes which don't apply to kirkstone. (From yocto-docs rev: 95171233f0e96c00d55ed40cf713c62e6df57b8d) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'documentation/dev-manual/python-development-shell.rst')
-rw-r--r--documentation/dev-manual/python-development-shell.rst50
1 files changed, 50 insertions, 0 deletions
diff --git a/documentation/dev-manual/python-development-shell.rst b/documentation/dev-manual/python-development-shell.rst
new file mode 100644
index 0000000000..2dc6a3f138
--- /dev/null
+++ b/documentation/dev-manual/python-development-shell.rst
@@ -0,0 +1,50 @@
1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2
3Using a Python Development Shell
4********************************
5
6Similar to working within a development shell as described in the
7previous section, you can also spawn and work within an interactive
8Python development shell. When debugging certain commands or even when
9just editing packages, ``pydevshell`` can be a useful tool. When you
10invoke the ``pydevshell`` task, all tasks up to and including
11:ref:`ref-tasks-patch` are run for the
12specified target. Then a new terminal is opened. Additionally, key
13Python objects and code are available in the same way they are to
14BitBake tasks, in particular, the data store 'd'. So, commands such as
15the following are useful when exploring the data store and running
16functions::
17
18 pydevshell> d.getVar("STAGING_DIR")
19 '/media/build1/poky/build/tmp/sysroots'
20 pydevshell> d.getVar("STAGING_DIR", False)
21 '${TMPDIR}/sysroots'
22 pydevshell> d.setVar("FOO", "bar")
23 pydevshell> d.getVar("FOO")
24 'bar'
25 pydevshell> d.delVar("FOO")
26 pydevshell> d.getVar("FOO")
27 pydevshell> bb.build.exec_func("do_unpack", d)
28 pydevshell>
29
30See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:functions you can call from within python`"
31section in the BitBake User Manual for details about available functions.
32
33The commands execute just as if the OpenEmbedded build
34system were executing them. Consequently, working this way can be
35helpful when debugging a build or preparing software to be used with the
36OpenEmbedded build system.
37
38Following is an example that uses ``pydevshell`` on a target named
39``matchbox-desktop``::
40
41 $ bitbake matchbox-desktop -c pydevshell
42
43This command spawns a terminal and places you in an interactive Python
44interpreter within the OpenEmbedded build environment. The
45:term:`OE_TERMINAL` variable
46controls what type of shell is opened.
47
48When you are finished using ``pydevshell``, you can exit the shell
49either by using Ctrl+d or closing the terminal window.
50