template.bbclass: fix warning by using a raw string for regular expressions

Message ID DB3PR10MB690833DFB0549256DC3F56FFE6242@DB3PR10MB6908.EURPRD10.PROD.OUTLOOK.COM
State Accepted, archived
Headers show
Series template.bbclass: fix warning by using a raw string for regular expressions | expand

Commit Message

nicusor.huhulea@siemens.com March 11, 2024, 1:44 p.m. UTC
the warning is:
DEBUG: Executing python function do_transform_template
/build/../work/isar/meta/classes/template.bbclass:24: DeprecationWarning: invalid escape sequence '\$'

fix this by adding 'r' before opening quote in order to treat the string
as raw string, preventing the interpretation of backslashes as escape characters

Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com>

Comments

Uladzimir Bely March 15, 2024, 1:01 p.m. UTC | #1
On Mon, 2024-03-11 at 13:44 +0000, 'nicusor.huhulea@siemens.com' via
isar-users wrote:
> the warning is:
> DEBUG: Executing python function do_transform_template
> /build/../work/isar/meta/classes/template.bbclass:24:
> DeprecationWarning: invalid escape sequence '\$'
> 
> fix this by adding 'r' before opening quote in order to treat the
> string
> as raw string, preventing the interpretation of backslashes as escape
> characters
> 
> Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com>
> 

Applied to next, thanks.

Patch

diff --git a/meta/classes/template.bbclass b/meta/classes/template.bbclass
index 1f4cedbd..7f8d5d8f 100644
--- a/meta/classes/template.bbclass
+++ b/meta/classes/template.bbclass
@@ -21,7 +21,7 @@  python do_transform_template() {
         return
 
     cmd = "envsubst"
-    args = " ".join("\${{{}}}".format(i) for i in template_vars)
+    args = " ".join(r"\${{{}}}".format(i) for i in template_vars)
 
     # Copy current process environment and add template variables
     # from bitbake data store: