1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/usr/bin/env python
def increment(line):
numbertext = line[len(endstring):]
if numbertext > " ":
return str(int(numbertext) + 1)
else:
return "0"
f = open("../src/Misc/ConfBuild.h","r+")
line = "start"
found = 0
endstring = "#define BUILD_NUMBER"
text = "0"
while line != "" and found == 0:
mark = f.tell()
line = f.readline()
if endstring in line:
found = mark
text = increment(line)
if found == 0:
found = mark
f.seek(found)
f.write("#define BUILD_NUMBER " + text + "\n")
f.truncate()
f.close()
print("BUILD_NUMBER " + text + "\n")
|