diff options
author | 2024-12-17 01:47:19 -0800 | |
---|---|---|
committer | 2024-12-30 08:12:42 -0500 | |
commit | bfca22a52ec54c77ed0d34a56338bc1fe0a3b0db (patch) | |
tree | ccba921fd4022ae25932d3751b572f7a2e680186 | |
parent | df5de61e6e52a24b7851b68cb8dd1e226ac1fb69 (diff) | |
download | yocto-kernel-tools-master.tar.gz |
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 <hongxu.jia@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rwxr-xr-x | tools/symbol_why.py | 6 |
1 files 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: |