Created
January 29, 2020 01:18
-
-
Save carlosmuvi/d95dd66badfd51819a2ee8827a48cf04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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