update_manpages.py: treat regex as raw string

Treat the values in the regex map as raw strings to fix
Invalid escape sequence 'g' (W605).

Change-Id: I53bf5d6bd1e1d6a1d1293e4f55640b6513bf3075
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354698
Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Daniel Kutik 2022-12-13 10:01:45 +01:00
parent 7438aef1ca
commit 37ae75f27d

View File

@ -109,10 +109,10 @@ def replace_regex(data):
Updated manpage text.
"""
regex = (
(r'(It was generated by help2man) [0-9.]+', '\g<1>.'),
(r'^\033\[[0-9;]*m([^\033]*)\033\[m', '\g<1>'),
(r'^\.IP\n(.*:)\n', '.SS \g<1>\n'),
(r'^\.PP\nDescription', '.SH DETAILS'),
(r'(It was generated by help2man) [0-9.]+', r'\g<1>.'),
(r'^\033\[[0-9;]*m([^\033]*)\033\[m', r'\g<1>'),
(r'^\.IP\n(.*:)\n', r'.SS \g<1>\n'),
(r'^\.PP\nDescription', r'.SH DETAILS'),
)
for pattern, replacement in regex:
data = re.sub(pattern, replacement, data, flags=re.M)