Skip to content

Commit 50679e4

Browse files
committed
[build] Auto-generate .version_info and verify installer version.
1 parent 20f6848 commit 50679e4

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ install:
4646
- echo * * BUILDING WINDOWS EXE * *
4747
- echo * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4848
# Build Windows .EXE and create portable .ZIP
49+
- python dist/pre_release.py
4950
- pyinstaller dist/scenedetect.spec
5051
- sphinx-build -b singlehtml docs dist/scenedetect/docs
5152
- mkdir dist\scenedetect\thirdparty
@@ -68,7 +69,7 @@ install:
6869
- appveyor-tools\secure-file -decrypt license65.dat.enc -secret %ai_license_secret% -salt %ai_license_salt%
6970
- appveyor DownloadFile https://www.advancedinstaller.com/downloads/advinst.msi
7071
- msiexec /i advinst.msi /qn
71-
- 'SET PATH=%PATH%;C:\\Program Files (x86)\\Caphyon\\Advanced Installer 21.5\\bin\\x86'
72+
- 'SET PATH=%PATH%;C:\\Program Files (x86)\\Caphyon\\Advanced Installer 21.8.1\\bin\\x86'
7273
# License path must be absolute
7374
- AdvancedInstaller.com /RegisterOffline "%cd%\license65.dat"
7475
# Create MSI installer

dist/.version_info renamed to dist/pre_release.py

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,40 @@
1-
# UTF-8
2-
#
3-
# TODO: Generate this using Python.
1+
# -*- coding: utf-8 -*-
2+
import os
3+
import sys
4+
import xml
5+
sys.path.append(os.path.abspath("."))
6+
7+
import scenedetect
8+
VERSION = scenedetect.__version__
9+
10+
11+
installer_aip = ''
12+
with open("dist/installer/PySceneDetect.aip", "r") as f:
13+
installer_aip = f.read()
14+
15+
aip_version = f"<ROW Property=\"ProductVersion\" Value=\"{VERSION}\" Options=\"32\"/>"
16+
17+
assert aip_version in installer_aip, f"Installer project version does not match {VERSION}."
18+
19+
with open("dist/.version_info", "wb") as f:
20+
v = VERSION.split(".")
21+
assert 2 <= len(v) <= 3, f"Unrecognized version format: {VERSION}"
22+
23+
if len(v) == 3:
24+
(maj, min, pat) = int(v[0]), int(v[1]), int(v[2])
25+
else:
26+
(maj, min, pat) = int(v[0]), int(v[1]), 0
27+
28+
f.write(f"""# UTF-8
429
#
530
# For more details about fixed file info 'ffi' see:
631
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
732
VSVersionInfo(
833
ffi=FixedFileInfo(
934
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
1035
# Set not needed items to zero 0.
11-
filevers=(0, 6, 3, 0),
12-
prodvers=(0, 6, 3, 0),
36+
filevers=(0, {maj}, {min}, {pat}),
37+
prodvers=(0, {maj}, {min}, {pat}),
1338
# Contains a bitmask that specifies the valid bits 'flags'r
1439
mask=0x3f,
1540
# Contains a bitmask that specifies the Boolean attributes of the file.
@@ -33,13 +58,14 @@
3358
u'040904B0',
3459
[StringStruct(u'CompanyName', u'github.com/Breakthrough'),
3560
StringStruct(u'FileDescription', u'www.scenedetect.com'),
36-
StringStruct(u'FileVersion', u'v0.6.3'),
61+
StringStruct(u'FileVersion', u'{VERSION}'),
3762
StringStruct(u'InternalName', u'PySceneDetect'),
3863
StringStruct(u'LegalCopyright', u'Copyright © 2024 Brandon Castellano'),
3964
StringStruct(u'OriginalFilename', u'scenedetect.exe'),
4065
StringStruct(u'ProductName', u'PySceneDetect'),
41-
StringStruct(u'ProductVersion', u'v0.6.3')])
66+
StringStruct(u'ProductVersion', u'{VERSION}')])
4267
]),
4368
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
4469
]
4570
)
71+
""".encode())

0 commit comments

Comments
 (0)