Skip to content

Commit d2dec6c

Browse files
committed
PICARD-1364: Write version information to picard.exe
1 parent bda4858 commit d2dec6c

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ po/countries/countries.pot
1616
po/attributes/attributes.pot
1717
scripts/picard
1818
.*.sw[a-z]
19+
win-version-info.txt

picard.spec

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ exe = EXE(pyz,
8888
strip=False,
8989
upx=False,
9090
icon='picard.ico',
91+
version='win-version-info.txt',
9192
console=False)
9293

9394

setup.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
)
2323
from setuptools.dist import Distribution
2424

25-
from picard import __version__
25+
from picard import PICARD_VERSION, __version__
2626

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

win-version-info.txt.in

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# UTF-8
2+
#
3+
# For more details about fixed file info 'ffi' see:
4+
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
5+
6+
VSVersionInfo(
7+
ffi=FixedFileInfo(
8+
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
9+
# Set not needed items to zero 0.
10+
filevers=%(filevers)s,
11+
prodvers=%(prodvers)s,
12+
# Contains a bitmask that specifies the valid bits 'flags'
13+
mask=0x3f,
14+
# Contains a bitmask that specifies the Boolean attributes of the file.
15+
flags=0x0,
16+
# The operating system for which this file was designed.
17+
# 0x4 - NT and there is no need to change it.
18+
OS=0x4,
19+
# The general type of file.
20+
# 0x1 - the file is an application.
21+
fileType=0x1,
22+
# The function of the file.
23+
# 0x0 - the function is not defined for this fileType
24+
subtype=0x0,
25+
# Creation date and time stamp.
26+
date=(0, 0)
27+
),
28+
kids=[
29+
StringFileInfo(
30+
[
31+
StringTable(
32+
u'040904b0',
33+
[StringStruct(u'CompanyName', u'MetaBrainz Foundation'),
34+
StringStruct(u'ProductName', u'%(name)s'),
35+
StringStruct(u'ProductVersion', u'%(version)s'),
36+
StringStruct(u'FileVersion', u'%(version)s'),
37+
StringStruct(u'InternalName', u'Picard'),
38+
StringStruct(u'OriginalFilename', u'picard.exe'),
39+
StringStruct(u'FileDescription', u'MusicBrainz Picard Tagger'),
40+
#StringStruct(u'LegalCopyright', u'Copyright 2004-2018'),
41+
#StringStruct(u'LegalTrademarks', u''),
42+
])
43+
]),
44+
VarFileInfo([VarStruct(u'Translation', [1033, 0])])
45+
]
46+
)

0 commit comments

Comments
 (0)