[bootlin/training-materials updates] master: yocto: slides: mention inline python alongside python tasks (c7a85773)
Luca Ceresoli
luca.ceresoli at bootlin.com
Thu Aug 18 10:19:11 CEST 2022
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/c7a85773299b508d4b2e4834f634444dfd71f9e0
>---------------------------------------------------------------
commit c7a85773299b508d4b2e4834f634444dfd71f9e0
Author: Luca Ceresoli <luca.ceresoli at bootlin.com>
Date: Wed Aug 17 14:53:45 2022 +0200
yocto: slides: mention inline python alongside python tasks
This is used in the slides, and it can be rather obscure to newcomers.
Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>
>---------------------------------------------------------------
c7a85773299b508d4b2e4834f634444dfd71f9e0
slides/yocto-recipe-extra/yocto-recipe-extra.tex | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/slides/yocto-recipe-extra/yocto-recipe-extra.tex b/slides/yocto-recipe-extra/yocto-recipe-extra.tex
index 89cb65d4..9f36a70a 100644
--- a/slides/yocto-recipe-extra/yocto-recipe-extra.tex
+++ b/slides/yocto-recipe-extra/yocto-recipe-extra.tex
@@ -114,7 +114,7 @@ PACKAGECONFIG ??= "wispr iptables client\
\end{itemize}
\end{frame}
-\subsection{Python tasks}
+\subsection{Using Python code in metadata}
\begin{frame}
\frametitle{Tasks in Python}
@@ -131,6 +131,8 @@ PACKAGECONFIG ??= "wispr iptables client\
\item You can import other modules using the keyword
\code{import}.
\item Anonymous Python functions are executed during parsing.
+ \item Short Python code snippets can be written inline with the {\tt
+ \$\{@<python code>\}} syntax.
\end{itemize}
\end{frame}
@@ -153,21 +155,26 @@ PACKAGECONFIG ??= "wispr iptables client\
\end{frame}
\begin{frame}[fragile]
- \frametitle{Python task example}
+ \frametitle{Python code examples}
\begin{minted}{python}
# Anonymous function
python __anonymous() {
if d.getVar("FOO", True) == "example":
d.setVar("BAR", "Hello, World.")
}
-
# Task
python do_settime() {
import time
-
d.setVar("TIME", time.strftime('%Y%m%d', time.gmtime()))
}
\end{minted}
+ \begin{minted}{sh}
+# Inline
+do_install() {
+ echo "Build OS: ${@os.uname()[0].lower()}"
+}
+
+ \end{minted}
\end{frame}
\subsection{Root filesystem creation}
More information about the training-materials-updates
mailing list