Similar to working within a development shell as described in
the previous section, you can also spawn and work within an
interactive Python development shell.
When debugging certain commands or even when just editing packages,
devpyshell
can be a useful tool.
When you invoke devpyshell
, all tasks up to and
including
do_patch
are run for the specified target.
Then a new terminal is opened.
Additionally, key Python objects and code are available in the same
way they are to BitBake tasks, in particular, the data store 'd'.
So, commands such as the following are useful when exploring the data
store and running functions:
pydevshell> d.getVar("STAGING_DIR") '/media/build1/poky/build/tmp/sysroots' pydevshell> d.getVar("STAGING_DIR") '${TMPDIR}/sysroots' pydevshell> d.setVar("FOO", "bar") pydevshell> d.getVar("FOO") 'bar' pydevshell> d.delVar("FOO") pydevshell> d.getVar("FOO") pydevshell> bb.build.exec_func("do_unpack", d) pydevshell>
The commands execute just as if the OpenEmbedded build system were executing them. Consequently, working this way can be helpful when debugging a build or preparing software to be used with the OpenEmbedded build system.
Following is an example that uses devpyshell
on a target named
matchbox-desktop
:
$ bitbake matchbox-desktop -c devpyshell
This command spawns a terminal and places you in an interactive
Python interpreter within the OpenEmbedded build environment.
The OE_TERMINAL
variable controls what type of shell is opened.
When you are finished using devpyshell
, you
can exit the shell either by using Ctrl+d or closing the terminal
window.