aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Connolly <caleb.connolly@linaro.org>2024-05-03 17:18:36 +0200
committerTom Rini <trini@konsulko.com>2024-05-13 16:51:14 -0600
commit830d83ec385ddf9eeb541027ef09453657deed56 (patch)
treed09c0b561f5550eccbd574941304f79c85d9120e
parent4f652182a0777085eb9022648c33c5fd8356a0de (diff)
downloadu-boot-830d83ec385ddf9eeb541027ef09453657deed56.zip
u-boot-830d83ec385ddf9eeb541027ef09453657deed56.tar.gz
u-boot-830d83ec385ddf9eeb541027ef09453657deed56.tar.bz2
scripts: gen_compile_commands: fix invalid escape sequence warning
Since Python 3.12 unrecognised escape sequences trigger a SyntaxWarning. Convert the '\#' string to a raw string so the backslash is correctly used as a literal. Ported from Linux commit dae4a0171e25 ("gen_compile_commands: fix invalid escape sequence warning"). This updates the script to be in-line with Linux 6.9-rc6. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> Reviewed-by: João Marcos Costa <jmcosta944@gmail.com>
-rwxr-xr-xscripts/gen_compile_commands.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py
index fec513e..e746add 100755
--- a/scripts/gen_compile_commands.py
+++ b/scripts/gen_compile_commands.py
@@ -172,7 +172,7 @@ def process_line(root_directory, command_prefix, file_path):
# escape the pound sign '#', either as '\#' or '$(pound)' (depending on the
# kernel version). The compile_commands.json file is not interepreted
# by Make, so this code replaces the escaped version with '#'.
- prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#')
+ prefix = command_prefix.replace(r'\#', '#').replace('$(pound)', '#')
# Return the canonical path, eliminating any symbolic links encountered in the path.
abs_path = os.path.realpath(os.path.join(root_directory, file_path))