]> git.puffer.fish Git - matthieu/frr.git/commitdiff
build: fix a few python string escape warnings
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 23 Jul 2024 17:21:42 +0000 (10:21 -0700)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 23 Jul 2024 17:23:50 +0000 (10:23 -0700)
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>
doc/developer/conf.py
doc/manpages/conf.py
doc/user/conf.py
python/firstheader.py
python/makefile.py

index 6a3ffe16380e5adf41b6b9b8860c3bb75a07fc55..76dd1e4f289e81fa1cf86cc06ae971845a530740 100644 (file)
@@ -96,7 +96,7 @@ replace_vars = {
 
 # extract version information, installation location, other stuff we need to
 # use when building final documents
-val = re.compile('^S\["([^"]+)"\]="(.*)"$')
+val = re.compile(r'^S\["([^"]+)"\]="(.*)"$')
 try:
     with open("../../config.status", "r") as cfgstatus:
         for ln in cfgstatus.readlines():
index 73dea094ae9f916f8a04e237de25e2c004866d90..995885b22039b913c476a8fdc17a522cb6504328 100644 (file)
@@ -91,7 +91,7 @@ replace_vars = {
 
 # extract version information, installation location, other stuff we need to
 # use when building final documents
-val = re.compile('^S\["([^"]+)"\]="(.*)"$')
+val = re.compile(r'^S\["([^"]+)"\]="(.*)"$')
 try:
     with open("../../config.status", "r") as cfgstatus:
         for ln in cfgstatus.readlines():
index 395875520d7f6e277603b8349c30c452e77e5653..18f048bc08361561ccabea950b699b67b507624e 100644 (file)
@@ -96,7 +96,7 @@ replace_vars = {
 
 # extract version information, installation location, other stuff we need to
 # use when building final documents
-val = re.compile('^S\["([^"]+)"\]="(.*)"$')
+val = re.compile(r'^S\["([^"]+)"\]="(.*)"$')
 try:
     with open("../../config.status", "r") as cfgstatus:
         for ln in cfgstatus.readlines():
index 06e28958452e32aa547ca9f31947bc7e86522482..1a3cadfd5e89fa81e36cc72c3912e1a496d89e7f 100644 (file)
@@ -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/"),
index 573871fb68c746678281cd89d3e3d2927e488232..45f032296f3bfe17a1fa0497081bef1113ad46b6 100644 (file)
@@ -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)