Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import sys
import fileinput
import re
inputVersion = sys.argv[1]
print inputVersion
pattern = re.compile("\d*.\d*.\d*.\d*")
versionRegex = r'\s*const val versionNumber = "\d*\.\d*\.\d*\.\d*"'
versionPattern = re.compile(versionRegex, re.IGNORECASE)
if pattern.match(inputVersion):
for line in fileinput.input("../buildSrc/src/main/java/Dependencies.kt", inplace = 1):
if versionPattern.match(line):
line = re.sub(versionRegex, ' const val versionNumber = "%s"' % inputVersion, line)
print(line),
else:
print("input version doesn't match the pattern x.x.x.x")
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.