initial commit

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
2025-10-31 23:37:30 +01:00
commit 7228269764
9653 changed files with 4034514 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
# Common helpers for UpdateRelease.py and UpdateDates.py.
import re
def get_current_release():
with open('configure.ac', 'r') as file:
content = file.read()
matches = [match[1] for match in re.findall(r"m4_define\(pcre2_(major|minor|prerelease), \[(.*?)\]\)", content)]
current_release = '%s.%s%s' % tuple(matches)
return current_release
CURRENT_RELEASE = get_current_release()
# Update a file, using a pattern. Verify that it matches the file, and perform
# the replacement.
def update_file(filename, pattern, replacement):
with open(filename, 'r') as file:
content = file.read()
if not re.search(pattern, content):
raise Exception('Pattern not found in %s' % filename)
content = re.sub(pattern, replacement, content)
with open(filename, 'w') as file:
file.write(content)