boinc/client/win/update-boinc-gui-version

28 lines
828 B
Python
Executable File

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