summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2024-02-21 20:36:54 +0100
committerSteve Sakoman <steve@sakoman.com>2024-02-26 04:00:09 -1000
commit2f8982ef4c903f43867da56fcfd080a6556daa8b (patch)
tree4f757317cd4108d5feaf7a43360bfc021f00aa43 /scripts
parentb9dcdf2346bb24866c5f3db96a3f79eba20e4662 (diff)
downloadopenembedded-core-contrib-2f8982ef4c903f43867da56fcfd080a6556daa8b.tar.gz
scripts/runqemu: fix regex escape sequences
When invoking runqemu with Python 3.12, the following warning is encountered: |SyntaxWarning: invalid escape sequence '\.' This is because the interpreter scans the string before it is processed by the regex module, and it interprets the backslash as part of an escape sequence, but not a standard one. This will be registered as an error rather than a warning in future Python versions. To avoid the it, simply add an extra backslash so that Python doesn't misinterpret the string, while the regex parser still sees an escaped '.' character. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Backported from master: 0e8a4142bb90a92d175df6b2537d24a372356f98 Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 8e5d22888d..81d95133b6 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -362,7 +362,7 @@ class BaseConfig(object):
if p.endswith('.qemuboot.conf'):
self.qemuboot = p
self.qbconfload = True
- elif re.search('\.bin$', p) or re.search('bzImage', p) or \
+ elif re.search('\\.bin$', p) or re.search('bzImage', p) or \
re.search('zImage', p) or re.search('vmlinux', p) or \
re.search('fitImage', p) or re.search('uImage', p):
self.kernel = p
@@ -376,13 +376,13 @@ class BaseConfig(object):
fst = t
break
if not fst:
- m = re.search('.*\.(.*)$', self.rootfs)
+ m = re.search('.*\\.(.*)$', self.rootfs)
if m:
fst = m.group(1)
if fst:
self.check_arg_fstype(fst)
- qb = re.sub('\.' + fst + "$", '', self.rootfs)
- qb = '%s%s' % (re.sub('\.rootfs$', '', qb), '.qemuboot.conf')
+ qb = re.sub('\\.' + fst + "$", '', self.rootfs)
+ qb = '%s%s' % (re.sub('\\.rootfs$', '', qb), '.qemuboot.conf')
if os.path.exists(qb):
self.qemuboot = qb
self.qbconfload = True