Fix updateVersionPlaceholder when the placeholder starts the line

This commit is contained in:
Martin Hořeňovský 2020-12-29 15:02:11 +01:00
parent 48f220b68a
commit 23760327ae
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -127,8 +127,8 @@ def updateVersionDefine(version):
def updateVersionPlaceholder(filename, version): def updateVersionPlaceholder(filename, version):
with open(filename, 'rb') as file: with open(filename, 'rb') as file:
lines = file.readlines() lines = file.readlines()
placeholderRegex = re.compile(b' in Catch[0-9]? X.Y.Z') placeholderRegex = re.compile(b'in Catch[0-9]? X.Y.Z')
replacement = ' in Catch2 {}.{}.{}'.format(version.majorVersion, version.minorVersion, version.patchNumber).encode('ascii') replacement = 'in Catch2 {}.{}.{}'.format(version.majorVersion, version.minorVersion, version.patchNumber).encode('ascii')
with open(filename, 'wb') as file: with open(filename, 'wb') as file:
for line in lines: for line in lines:
file.write(placeholderRegex.sub(replacement, line)) file.write(placeholderRegex.sub(replacement, line))