summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-07-23 10:21:42 -0700
committerDavid Lamparter <equinox@opensourcerouting.org>2024-07-23 10:23:50 -0700
commit8916953b534f64a7545860ad5b4b36dc2544f33a (patch)
tree98fa71269f150691adbc58aee6d843e608029c64
parent04b818dd4ca1b490da500aff5f40f07ff8e20396 (diff)
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>
-rw-r--r--doc/developer/conf.py2
-rw-r--r--doc/manpages/conf.py2
-rw-r--r--doc/user/conf.py2
-rw-r--r--python/firstheader.py2
-rw-r--r--python/makefile.py2
5 files changed, 5 insertions, 5 deletions
diff --git a/doc/developer/conf.py b/doc/developer/conf.py
index 6a3ffe1638..76dd1e4f28 100644
--- a/doc/developer/conf.py
+++ b/doc/developer/conf.py
@@ -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():
diff --git a/doc/manpages/conf.py b/doc/manpages/conf.py
index 73dea094ae..995885b220 100644
--- a/doc/manpages/conf.py
+++ b/doc/manpages/conf.py
@@ -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():
diff --git a/doc/user/conf.py b/doc/user/conf.py
index 395875520d..18f048bc08 100644
--- a/doc/user/conf.py
+++ b/doc/user/conf.py
@@ -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():
diff --git a/python/firstheader.py b/python/firstheader.py
index 06e2895845..1a3cadfd5e 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 573871fb68..45f032296f 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)