summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-07-23 19:21:42 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2024-07-23 19:23:50 +0200
commit8916953b534f64a7545860ad5b4b36dc2544f33a (patch)
tree98fa71269f150691adbc58aee6d843e608029c64 /python
parentMerge pull request #16425 from opensourcerouting/fix/do_not_prepend_an_empty_... (diff)
downloadfrr-8916953b534f64a7545860ad5b4b36dc2544f33a.tar.xz
frr-8916953b534f64a7545860ad5b4b36dc2544f33a.zip
build: fix a few python string escape warnings
When using a regex (or anything that uses `\?` escapes) in python, raw strings (`r"content"`) should be used so python doesn't consume the escapes itself. Otherwise we get either broken behavior and/or `SyntaxWarning: invalid escape sequence '\['` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'python')
-rw-r--r--python/firstheader.py2
-rw-r--r--python/makefile.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/python/firstheader.py b/python/firstheader.py
index 06e289584..1a3cadfd5 100644
--- a/python/firstheader.py
+++ b/python/firstheader.py
@@ -15,7 +15,7 @@ argp.add_argument("--autofix", action="store_const", const=True)
argp.add_argument("--warn-empty", action="store_const", const=True)
argp.add_argument("--pipe", action="store_const", const=True)
-include_re = re.compile('^#\s*include\s+["<]([^ ">]+)[">]', re.M)
+include_re = re.compile(r'^#\s*include\s+["<]([^ ">]+)[">]', re.M)
ignore = [
lambda fn: fn.startswith("tools/"),
diff --git a/python/makefile.py b/python/makefile.py
index 573871fb6..45f032296 100644
--- a/python/makefile.py
+++ b/python/makefile.py
@@ -91,7 +91,7 @@ lines = before.splitlines()
autoderp = "#AUTODERP# "
out_lines = []
bcdeps = []
-make_rule_re = re.compile("^([^:\s]+):\s*([^:\s]+)\s*($|\n)")
+make_rule_re = re.compile(r"^([^:\s]+):\s*([^:\s]+)\s*($|\n)")
while lines:
line = lines.pop(0)