Use raw strings for regexes; fixes SyntaxWarning: invalid escape sequence

This commit is contained in:
Keir Fraser
2024-12-05 08:23:00 +00:00
parent 98fc55679d
commit 23b19de571
2 changed files with 2 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ def mk_cat_entry(dat, hw_model, major, minor, sig):
def new_upd(argv):
dat = b'GWUP'
m = re.match('([^-]+)-(\d+)\.(\d+)-(y?)', argv[1])
m = re.match(r'([^-]+)-(\d+)\.(\d+)-(y?)', argv[1])
hw_model = name_to_hw_model[m.group(1)]
major, minor = int(m.group(2)), int(m.group(3))
is_bootloader = (m.group(4) == 'y')

View File

@@ -21,7 +21,7 @@ objdir = sys.argv[1]
stem = objdir[objdir.rfind('/out'):]
# stem = [/<rest_of_path>]
m = re.match('/[^/]*'*NR_LEVELS+'(/.*)?', stem)
m = re.match(r'/[^/]*'*NR_LEVELS+r'(/.*)?', stem)
stem = '' if m.group(1) is None else m.group(1)
# srcdir = path to sources, relative to objdir