From 3e071312a034d9c24250dcf2ff25814c1d2bf26c Mon Sep 17 00:00:00 2001 From: Ivan Holmes Date: Tue, 4 Aug 2020 19:03:23 +0100 Subject: [PATCH] script to generate version.rc for windows --- generate_version_rc.py | 15 +++++++++++++++ version.rc.template | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 generate_version_rc.py create mode 100644 version.rc.template diff --git a/generate_version_rc.py b/generate_version_rc.py new file mode 100644 index 0000000..e9c9e6a --- /dev/null +++ b/generate_version_rc.py @@ -0,0 +1,15 @@ +import _version + +with open('version.rc.template', 'r') as verstf: + verstemp = verstf.read() + +major, minor, patch = _version.version.split(".") + +verstemp = verstemp.replace("%APPNAME%", _version.appName) +verstemp = verstemp.replace("%VERSION%", _version.version) +verstemp = verstemp.replace("%MAJOR_VERSION%", major) +verstemp = verstemp.replace("%MINOR_VERSION%", minor) +verstemp = verstemp.replace("%PATCH_VERSION%", patch) + +with open('version.rc', 'w') as versf: + versf.write(verstemp) \ No newline at end of file diff --git a/version.rc.template b/version.rc.template new file mode 100644 index 0000000..ddefa4d --- /dev/null +++ b/version.rc.template @@ -0,0 +1,43 @@ +# UTF-8 +# +# For more details about fixed file info 'ffi' see: +# http://msdn.microsoft.com/en-us/library/ms646997.aspx +VSVersionInfo( + ffi=FixedFileInfo( +# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) +# Set not needed items to zero 0. +filevers=(%MAJOR_VERSION%, %MINOR_VERSION%, %PATCH_VERSION%, 0), +prodvers=(%MAJOR_VERSION%, %MINOR_VERSION%, %PATCH_VERSION%, 0), +# Contains a bitmask that specifies the valid bits 'flags'r +mask=0x3f, +# Contains a bitmask that specifies the Boolean attributes of the file. +flags=0x0, +# The operating system for which this file was designed. +# 0x4 - NT and there is no need to change it. +OS=0x4, +# The general type of file. +# 0x1 - the file is an application. +fileType=0x1, +# The function of the file. +# 0x0 - the function is not defined for this fileType +subtype=0x0, +# Creation date and time stamp. +date=(0, 0) +), + kids=[ +StringFileInfo( + [ + StringTable( + u'040904B0', + [StringStruct(u'CompanyName', u'Ivan Holmes'), + StringStruct(u'FileDescription', u'%APPNAME%'), + StringStruct(u'FileVersion', %VERSION%), + StringStruct(u'InternalName', u'%APPNAME%'), + StringStruct(u'LegalCopyright', u'Copyright (c) Ivan Holmes, 2020. Some rights reserved.'), + StringStruct(u'OriginalFilename', u'chordsheet.exe'), + StringStruct(u'ProductName', u'%APPNAME%'), + StringStruct(u'ProductVersion', %VERSION%)]) + ]), +VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) + ] +) \ No newline at end of file