#
import sys,re
if __name__=="__main__":
rc = sys.argv[1]
ver = sys.argv[2]
ver = ver.replace('.', ',')
ver1 = ver.replace(',' , ', ')
rc = rc.replace("\\\\","\\")
f = open(rc,'r')
lines = f.readlines()
olines = []
for l in lines:
if l.startswith(' FILEVERSION '):
l = ' FILEVERSION ' + ver + '\n'
elif l.startswith(' PRODUCTVERSION '):
l = ' PRODUCTVERSION ' + ver + '\n'
else:
l = re.sub( r'(\s+VALUE\s"FileVersion",\s+)"(.*)"',r'\1"%s"' % ver1 , l )
l = re.sub( r'(\s+VALUE\s"ProductVersion",\s+)"(.*)"',r'\1"%s"' % ver1 , l )
olines.append(l)
f.close()
f = open(rc,'w')
f.writelines(olines)
f.close()