[PATCH] utils: ipc: extract-docs: Fix escape characters in regex

Paul Elder paul.elder at ideasonboard.com
Mon Jan 22 12:01:04 CET 2024


Newer versions of python now generate a SyntaxWarning (SyntaxError in
the future [1]) for invalid escape sequences. Fix this, as there were
invalid escape sequences in the regexes:

"libcamera/utils/ipc/./extract-docs.py:13: SyntaxWarning: invalid escape
sequence '\/'"

[1] https://docs.python.org/3.12/library/re.html

Reported-by: Nicolas Dufresne <nicolas at ndufresne.ca>
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
I'm not actually able to reproduce the warning in the first place, but
from my understanding this should fix the problem. Nicolas, could you
confirm this please?
---
 utils/ipc/extract-docs.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/utils/ipc/extract-docs.py b/utils/ipc/extract-docs.py
index 8f7fff9ff..c2050c998 100755
--- a/utils/ipc/extract-docs.py
+++ b/utils/ipc/extract-docs.py
@@ -10,9 +10,9 @@ import argparse
 import re
 import sys
 
-regex_block_start = re.compile('^\/\*\*$')
-regex_block_end = re.compile('^ \*\/$')
-regex_spdx = re.compile('^\/\* SPDX-License-Identifier: .* \*\/$')
+regex_block_start = re.compile(r'^/\*\*$')
+regex_block_end = re.compile(r'^ \*/$')
+regex_spdx = re.compile(r'^/\* SPDX-License-Identifier: .* \*/$')
 
 
 def main(argv):
-- 
2.39.2



More information about the libcamera-devel mailing list