boinc/client/win/update-resource-version

73 lines
2.0 KiB
Python
Executable File

#!/usr/bin/env python
# $Id$
# update resource.rc with version numbers.
import sys
sys.path.append('../../py')
try:
from version import *
except ImportError:
raise SystemExit("""testbase.py: Couldn't import version.py
This file is built from py/version.py.in by configure.
Perhaps you did not run configure, or you configured in a different directory,
or you are running from the wrong directory.""")
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)
# VS_VERSION_INFO VERSIONINFO
# FILEVERSION 1,0,8,0
# PRODUCTVERSION 1,0,8,0
# FILEFLAGSMASK 0x3fL
# #ifdef _DEBUG
# FILEFLAGS 0x1L
# #else
# FILEFLAGS 0x0L
# #endif
# FILEOS 0x40004L
# FILETYPE 0x1L
# FILESUBTYPE 0x0L
# BEGIN
# BLOCK "StringFileInfo"
# BEGIN
# BLOCK "040904b0"
# BEGIN
# VALUE "Comments", "\0"
# VALUE "CompanyName", "Space Sciences Laboratory\0"
# VALUE "FileDescription", "boinc_gui\0"
# VALUE "FileVersion", "1, 0, 8, 0\0"
# VALUE "InternalName", "boinc_gui\0"
# VALUE "LegalCopyright", "Copyright © 2003 SETI@home\0"
# VALUE "LegalTrademarks", "\0"
# VALUE "OriginalFilename", "boinc_gui.exe\0"
# VALUE "PrivateBuild", "\0"
# VALUE "ProductName", "BOINC Core Client\0"
# VALUE "ProductVersion", "1, 0, 8, 0\0"
# VALUE "SpecialBuild", "\0"
# END
# END
# BLOCK "VarFileInfo"
# BEGIN
# VALUE "Translation", 0x409, 1200
# END
# END