Skip to content

Commit cdf9a3a

Browse files
committed
Add versioning information to exe prior to creating release.
1 parent 0453049 commit cdf9a3a

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

CI/updateVersion.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import sys
2+
import re
3+
4+
FILE_WITH_VERSION_INFORMATIONS = "version"
5+
6+
if len(sys.argv) != 2:
7+
print("""Problem with argument.\n
8+
Expected exactly one argument with new version number - e.g. '1.23.0.0'""")
9+
exit(1)
10+
11+
new_version = sys.argv[1]
12+
13+
if re.match(r"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+", new_version) == None:
14+
print("Wrong format of argument:", new_version,
15+
"\nRequired format: 1.23.0.0")
16+
exit(1)
17+
18+
new_version_commas = new_version.replace('.', ', ')
19+
20+
# Read data from template file
21+
fin = open(FILE_WITH_VERSION_INFORMATIONS + "_template.py", "rt")
22+
data = fin.read()
23+
data = data.replace('filevers=(78, 0, 3904, 108)',
24+
'filevers=(' + new_version_commas + ')')
25+
data = data.replace('prodvers=(78, 0, 3904, 108)',
26+
'prodvers=(' + new_version_commas + ')')
27+
data = data.replace("u'FileVersion', u'78, 0, 3904, 108'",
28+
"u'FileVersion', u'" + new_version + "'")
29+
data = data.replace("u'ProductVersion', u'78, 0, 3904, 108'",
30+
"u'ProductVersion', u'" + new_version + "'")
31+
fin.close()
32+
33+
# Write the data to new output file
34+
fin = open(FILE_WITH_VERSION_INFORMATIONS + ".py", "wt")
35+
fin.write(data)
36+
fin.close()
37+
38+
print(sys.argv[0], "- version updated to:", new_version)

CI/version.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
VSVersionInfo(
6+
ffi=FixedFileInfo(
7+
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
8+
# Set not needed items to zero 0.
9+
filevers=(2, 2, 1, 0),
10+
prodvers=(2, 2, 1, 0),
11+
# Contains a bitmask that specifies the valid bits 'flags'r
12+
mask=0x17,
13+
# Contains a bitmask that specifies the Boolean attributes of the file.
14+
flags=0x0,
15+
# The operating system for which this file was designed.
16+
# 0x4 - NT and there is no need to change it.
17+
OS=0x4,
18+
# The general type of file.
19+
# 0x1 - the file is an application.
20+
fileType=0x1,
21+
# The function of the file.
22+
# 0x0 - the function is not defined for this fileType
23+
subtype=0x0,
24+
# Creation date and time stamp.
25+
date=(0, 0)
26+
),
27+
kids=[
28+
StringFileInfo(
29+
[
30+
StringTable(
31+
u'040904b0',
32+
[StringStruct(u'CompanyName', u'NOAA NGS RSD'),
33+
StringStruct(u'FileDescription', u'cBlue'),
34+
StringStruct(u'FileVersion', u'2, 2, 1, 0'),
35+
StringStruct(u'InternalName', u'cBlue'),
36+
StringStruct(u'LegalCopyright', u'LGPL-2.1'),
37+
StringStruct(u'OriginalFilename', u'cBlue.exe'),
38+
StringStruct(u'ProductName', u'cBlue'),
39+
StringStruct(u'ProductVersion', u'2.2.1.0'),
40+
StringStruct(u'CompanyShortName', u'NOAA'),
41+
StringStruct(u'ProductShortName', u'cBlue'),
42+
StringStruct(u'LastChange', u'045304945a791ebf8850ddc90c2814b7d04b6d0c'),
43+
StringStruct(u'Official Build', u'2.2.1-rc2')])
44+
]),
45+
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
46+
]
47+
)

CI/version_template.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
VSVersionInfo(
6+
ffi=FixedFileInfo(
7+
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
8+
# Set not needed items to zero 0.
9+
filevers=(78, 0, 3904, 108),
10+
prodvers=(78, 0, 3904, 108),
11+
# Contains a bitmask that specifies the valid bits 'flags'r
12+
mask=0x17,
13+
# Contains a bitmask that specifies the Boolean attributes of the file.
14+
flags=0x0,
15+
# The operating system for which this file was designed.
16+
# 0x4 - NT and there is no need to change it.
17+
OS=0x4,
18+
# The general type of file.
19+
# 0x1 - the file is an application.
20+
fileType=0x1,
21+
# The function of the file.
22+
# 0x0 - the function is not defined for this fileType
23+
subtype=0x0,
24+
# Creation date and time stamp.
25+
date=(0, 0)
26+
),
27+
kids=[
28+
StringFileInfo(
29+
[
30+
StringTable(
31+
u'040904b0',
32+
[StringStruct(u'CompanyName', u'NOAA NGS RSD'),
33+
StringStruct(u'FileDescription', u'cBlue'),
34+
StringStruct(u'FileVersion', u'2, 2, 1, 0'),
35+
StringStruct(u'InternalName', u'cBlue'),
36+
StringStruct(u'LegalCopyright', u'LGPL-2.1'),
37+
StringStruct(u'OriginalFilename', u'cBlue.exe'),
38+
StringStruct(u'ProductName', u'cBlue'),
39+
StringStruct(u'ProductVersion', u'2.2.1.0'),
40+
StringStruct(u'CompanyShortName', u'NOAA'),
41+
StringStruct(u'ProductShortName', u'cBlue'),
42+
StringStruct(u'LastChange', u'045304945a791ebf8850ddc90c2814b7d04b6d0c'),
43+
StringStruct(u'Official Build', u'2.2.1-rc2')])
44+
]),
45+
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
46+
]
47+
)

0 commit comments

Comments
 (0)