Browse Source

script to generate version.rc for windows

master
Ivan Holmes 5 years ago
parent
commit
3e071312a0
  1. 15
      generate_version_rc.py
  2. 43
      version.rc.template

15
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)

43
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])])
]
)
Loading…
Cancel
Save