From: Hongxu Jia <[email protected]> Python 3.12 emmits a SyntaxWarning when using unescaped character inside a RegEx string. ''' recipe-sysroot-native/usr/bin/symbol_why.py:161: SyntaxWarning: invalid escape sequence '\.' if re.match( ".*\.config", opt ): recipe-sysroot-native/usr/bin/symbol_why.py:216: SyntaxWarning: invalid escape sequence '\w' x = re.match( "^# .*Linux/\w*\s*([0-9]*\.[0-9]*\.[0-9]*).*Kernel Configuration", line ) recipe-sysroot-native/usr/bin/symbol_why.py:495: SyntaxWarning: invalid escape sequence '\s' if re.search( "^#\s*CONFIG_", option ): '''
According to [1], use raw strings for regular expression [1] https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes Signed-off-by: Hongxu Jia <[email protected]> Signed-off-by: Steve Sakoman <[email protected]> --- ...yntaxWarning-for-RegEx-calls-on-Pyth.patch | 60 +++++++++++++++++++ .../kern-tools/kern-tools-native_git.bb | 4 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-kernel/kern-tools/files/0001-symbol_why-fix-SyntaxWarning-for-RegEx-calls-on-Pyth.patch diff --git a/meta/recipes-kernel/kern-tools/files/0001-symbol_why-fix-SyntaxWarning-for-RegEx-calls-on-Pyth.patch b/meta/recipes-kernel/kern-tools/files/0001-symbol_why-fix-SyntaxWarning-for-RegEx-calls-on-Pyth.patch new file mode 100644 index 0000000000..e87067c8ac --- /dev/null +++ b/meta/recipes-kernel/kern-tools/files/0001-symbol_why-fix-SyntaxWarning-for-RegEx-calls-on-Pyth.patch @@ -0,0 +1,60 @@ +From 1f64368e4e82e47cd0e0dfe37b0e1b8958566d21 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia <[email protected]> +Date: Tue, 17 Dec 2024 01:25:29 -0800 +Subject: [PATCH] symbol_why: fix SyntaxWarning for RegEx calls on Python 3.12 + +Python 3.12 emmits a SyntaxWarning when using unescaped +character inside a RegEx string. +''' +recipe-sysroot-native/usr/bin/symbol_why.py:161: SyntaxWarning: invalid escape sequence '\.' + if re.match( ".*\.config", opt ): +recipe-sysroot-native/usr/bin/symbol_why.py:216: SyntaxWarning: invalid escape sequence '\w' + x = re.match( "^# .*Linux/\w*\s*([0-9]*\.[0-9]*\.[0-9]*).*Kernel Configuration", line ) +recipe-sysroot-native/usr/bin/symbol_why.py:495: SyntaxWarning: invalid escape sequence '\s' + if re.search( "^#\s*CONFIG_", option ): +''' + +According to [1], use raw strings for regular expression + +[1] https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes + +Upstream-Status: Submitted [[email protected]] +Signed-off-by: Hongxu Jia <[email protected]> +--- + tools/symbol_why.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/symbol_why.py b/tools/symbol_why.py +index 326e84f..4864378 100755 +--- a/tools/symbol_why.py ++++ b/tools/symbol_why.py +@@ -158,7 +158,7 @@ for opt in args.args: + elif re.match( "--ksrc=*", opt): + temp, ksrc = opt.split('=', 2) + else: +- if re.match( ".*\.config", opt ): ++ if re.match( r".*\.config", opt ): + dotconfig=opt + elif not ksrc: + ksrc=opt +@@ -213,7 +213,7 @@ if not os.getenv("KERNELVERSION"): + hconfig = open( dotconfig ) + for line in hconfig: + line = line.rstrip() +- x = re.match( "^# .*Linux/\w*\s*([0-9]*\.[0-9]*\.[0-9]*).*Kernel Configuration", line ) ++ x = re.match( r"^# .*Linux/\w*\s*([0-9]*\.[0-9]*\.[0-9]*).*Kernel Configuration", line ) + if x: + os.environ["KERNELVERSION"] = x.group(1) + if verbose: +@@ -492,7 +492,7 @@ def split_option( config_option_str ): + opt = m.group(1) + val = m.group(2) + except: +- if re.search( "^#\s*CONFIG_", option ): ++ if re.search( r"^#\s*CONFIG_", option ): + # print( "option is a is not set!!! %s" % option ) + m = re.match(r"# (CONFIG_[^ ]+) is not set", option ) + if m: +-- +2.25.1 + diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb index 8eff00821a..7d11889eda 100644 --- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb +++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb @@ -16,7 +16,9 @@ PV = "0.3+git" inherit native -SRC_URI = "git://git.yoctoproject.org/yocto-kernel-tools.git;branch=master;protocol=https" +SRC_URI = "git://git.yoctoproject.org/yocto-kernel-tools.git;branch=master;protocol=https \ + file://0001-symbol_why-fix-SyntaxWarning-for-RegEx-calls-on-Pyth.patch \ +" S = "${WORKDIR}/git" do_configure() { -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#208889): https://lists.openembedded.org/g/openembedded-core/message/208889 Mute This Topic: https://lists.openembedded.org/mt/110188794/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
