Skip to content

Commit

Permalink
PICARD-1364: Write version information to picard.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
phw committed Oct 5, 2018
1 parent bda4858 commit d2dec6c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ po/countries/countries.pot
po/attributes/attributes.pot
scripts/picard
.*.sw[a-z]
win-version-info.txt
1 change: 1 addition & 0 deletions picard.spec
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ exe = EXE(pyz,
strip=False,
upx=False,
icon='picard.ico',
version='win-version-info.txt',
console=False)


Expand Down
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)
from setuptools.dist import Distribution

from picard import __version__
from picard import PICARD_VERSION, __version__

if sys.version_info < (3, 5):
sys.exit("ERROR: You need Python 3.5 or higher to use Picard.")
Expand Down Expand Up @@ -213,6 +213,12 @@ def run(self):
# Temporarily setting it to this value to generate a nice name for Windows app
args['name'] = 'MusicBrainz Picard'
generate_file('installer/picard-setup.nsi.in', 'installer/picard-setup.nsi', args)
version = str(PICARD_VERSION[0:3] + PICARD_VERSION[4:])
version_args = {
'filevers': version,
'prodvers': version,
}
generate_file('win-version-info.txt.in', 'win-version-info.txt', {**args, **version_args})
args['name'] = 'picard'
build.run(self)

Expand Down
46 changes: 46 additions & 0 deletions win-version-info.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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=%(filevers)s,
prodvers=%(prodvers)s,
# Contains a bitmask that specifies the valid bits 'flags'
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'MetaBrainz Foundation'),
StringStruct(u'ProductName', u'%(name)s'),
StringStruct(u'ProductVersion', u'%(version)s'),
StringStruct(u'FileVersion', u'%(version)s'),
StringStruct(u'InternalName', u'Picard'),
StringStruct(u'OriginalFilename', u'picard.exe'),
StringStruct(u'FileDescription', u'MusicBrainz Picard Tagger'),
#StringStruct(u'LegalCopyright', u'Copyright 2004-2018'),
#StringStruct(u'LegalTrademarks', u''),
])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 0])])
]
)

0 comments on commit d2dec6c

Please sign in to comment.