i was just reviewing a recipe I wrote a month or two ago and saw that I wrote:

do_compile() {
    python3 ${WORKDIR}/assemble-tsk-blob.py -o tsk-blob -d
${DEPLOY_DIR_IMAGE}/foo -t ${DEPLOY_DIR_IMAGE}/bar
}

and I thought to myself, why did I write assemble-tsk-blob.py (which
is a fairly trivial python 10 line script) instead of embedding it
inline in my bitbake recipe?

The answer is: because I could iterate on that 10 line script and test
it much more quickly as a standalone python script than I could if I
embedded it in a recipe.  (There are another 10-15 lines of argparse
and if __name__ == '__main__' stuff beyond the 10 lines of actual
code).

Since I'm in a cleaning-up mood, I started wondering if I could change
my do_compile() function to a python function and then embed the 10
lines in there.  Of course I can.

But then I started wondering if I could change do_compile to python,
have it import assemble-tsk-blob, and get the best of both worlds --
the ability to test assemble-tsk-blob outside of bitbake, and the
efficiency of including its core operation directly within
do_compile() and not requring that I spin up another python instance.

Aside... there is nothing python3-ish about this code, I am just in
the habit of unquestioningly using python3 for all new development.

Any thoughts?

--wpd
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#47607): https://lists.yoctoproject.org/g/yocto/message/47607
Mute This Topic: https://lists.yoctoproject.org/mt/67822266/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to