boinc/client/win/update-resource-version

26 lines
722 B
Python
Executable File

#!/usr/bin/env python
# $Id$
# update resource.rc with version numbers.
import boinc_path_config
from Boinc.version import *
import os, re
fn_rc_old = 'resource.rc.old'
fn_rc = 'resource.rc'
os.rename(fn_rc, fn_rc_old)
rc_old = open(fn_rc_old)
rc = open(fn_rc, 'w')
version_string = '%d,0,%d,0' % (MAJOR_VERSION, MINOR_VERSION)
version_string_spaces = '"%d, 0, %d, 0\\\\0"' % (MAJOR_VERSION, MINOR_VERSION)
for line in rc_old:
line = re.sub('( +(FILEVERSION|PRODUDUCTVERSION) +).*', '\\1'+version_string, line)
line = re.sub('( +VALUE "(FileVersion|ProductVersion)", +).*', '\\1'+version_string_spaces, line)
rc.write(line)
print "Updated resource.rc to version %d.%02d" %(MAJOR_VERSION, MINOR_VERSION)