summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2024-01-02 11:52:58 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-02 22:51:01 +0000
commit3c71605a77809d78be95d2b81b04fcaf232cd9c7 (patch)
tree3b92adbcc13b7f9e8546817a9a0c35766e452c05
parentbd05979aa8333d5bb2a5f058d2274af1873412a1 (diff)
downloadpoky-3c71605a77809d78be95d2b81b04fcaf232cd9c7.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. (From OE-Core rev: 0e8a4142bb90a92d175df6b2537d24a372356f98) Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/runqemu8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 6a5a6451da..f4d0420109 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -371,7 +371,7 @@ class BaseConfig(object):
371 if p.endswith('.qemuboot.conf'): 371 if p.endswith('.qemuboot.conf'):
372 self.qemuboot = p 372 self.qemuboot = p
373 self.qbconfload = True 373 self.qbconfload = True
374 elif re.search('\.bin$', p) or re.search('bzImage', p) or \ 374 elif re.search('\\.bin$', p) or re.search('bzImage', p) or \
375 re.search('zImage', p) or re.search('vmlinux', p) or \ 375 re.search('zImage', p) or re.search('vmlinux', p) or \
376 re.search('fitImage', p) or re.search('uImage', p): 376 re.search('fitImage', p) or re.search('uImage', p):
377 self.kernel = p 377 self.kernel = p
@@ -385,19 +385,19 @@ class BaseConfig(object):
385 fst = t 385 fst = t
386 break 386 break
387 if not fst: 387 if not fst:
388 m = re.search('.*\.(.*)$', self.rootfs) 388 m = re.search('.*\\.(.*)$', self.rootfs)
389 if m: 389 if m:
390 fst = m.group(1) 390 fst = m.group(1)
391 if fst: 391 if fst:
392 self.check_arg_fstype(fst) 392 self.check_arg_fstype(fst)
393 qb = re.sub('\.' + fst + "$", '.qemuboot.conf', self.rootfs) 393 qb = re.sub('\\.' + fst + "$", '.qemuboot.conf', self.rootfs)
394 if os.path.exists(qb): 394 if os.path.exists(qb):
395 self.qemuboot = qb 395 self.qemuboot = qb
396 self.qbconfload = True 396 self.qbconfload = True
397 else: 397 else:
398 logger.warning("%s doesn't exist, will try to remove '.rootfs' from filename" % qb) 398 logger.warning("%s doesn't exist, will try to remove '.rootfs' from filename" % qb)
399 # They to remove .rootfs (IMAGE_NAME_SUFFIX) as well 399 # They to remove .rootfs (IMAGE_NAME_SUFFIX) as well
400 qb = re.sub('\.rootfs.qemuboot.conf$', '.qemuboot.conf', qb) 400 qb = re.sub('\\.rootfs.qemuboot.conf$', '.qemuboot.conf', qb)
401 if os.path.exists(qb): 401 if os.path.exists(qb):
402 self.qemuboot = qb 402 self.qemuboot = qb
403 self.qbconfload = True 403 self.qbconfload = True