Update fixup_pdf_template.py for Python 3.12
Update the Python script to avoid SyntaxWarning for regular expression
strings.
Bug: 406190014
Change-Id: Ie85bf7b7f4f0538ab2c80202aaf5ba7eb84b4602
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/129930
Commit-Queue: Alan Screen <awscreen@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/tools/fixup_pdf_template.py b/testing/tools/fixup_pdf_template.py
index 06ed3c1..36369ba 100755
--- a/testing/tools/fixup_pdf_template.py
+++ b/testing/tools/fixup_pdf_template.py
@@ -65,10 +65,10 @@
STARTXREF_TOKEN = b'{{startxref}}'
STARTXREF_REPLACEMENT = b'startxref\n%d'
- STARTXREFOBJ_PATTERN = b'\{\{startxrefobj\s+(\d+)\s+(\d+)\}\}'
+ STARTXREFOBJ_PATTERN = rb'{{startxrefobj\s+(\d+)\s+(\d+)}}'
- OBJECT_PATTERN = b'\{\{object\s+(\d+)\s+(\d+)\}\}'
- OBJECT_REPLACEMENT = b'\g<1> \g<2> obj'
+ OBJECT_PATTERN = rb'{{object\s+(\d+)\s+(\d+)}}'
+ OBJECT_REPLACEMENT = rb'\g<1> \g<2> obj'
STREAMLEN_TOKEN = b'{{streamlen}}'
STREAMLEN_REPLACEMENT = b'/Length %d'
@@ -175,7 +175,7 @@
end_of_file_line_ending = False
with open(input_path, 'rb') as infile:
for line in infile:
- match = re.match(b'\s*\{\{include\s+(.+)\}\}', line)
+ match = re.match(rb'\s*{{include\s+(.+)}}', line)
if match:
insert_includes(
os.path.join(