|
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 |
4 | 29 | #
|
5 | 30 | # For more details about fixed file info 'ffi' see:
|
6 | 31 | # http://msdn.microsoft.com/en-us/library/ms646997.aspx
|
7 | 32 | VSVersionInfo(
|
8 | 33 | ffi=FixedFileInfo(
|
9 | 34 | # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
10 | 35 | # 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}), |
13 | 38 | # Contains a bitmask that specifies the valid bits 'flags'r
|
14 | 39 | mask=0x3f,
|
15 | 40 | # Contains a bitmask that specifies the Boolean attributes of the file.
|
|
33 | 58 | u'040904B0',
|
34 | 59 | [StringStruct(u'CompanyName', u'github.com/Breakthrough'),
|
35 | 60 | StringStruct(u'FileDescription', u'www.scenedetect.com'),
|
36 |
| - StringStruct(u'FileVersion', u'v0.6.3'), |
| 61 | + StringStruct(u'FileVersion', u'{VERSION}'), |
37 | 62 | StringStruct(u'InternalName', u'PySceneDetect'),
|
38 | 63 | StringStruct(u'LegalCopyright', u'Copyright © 2024 Brandon Castellano'),
|
39 | 64 | StringStruct(u'OriginalFilename', u'scenedetect.exe'),
|
40 | 65 | StringStruct(u'ProductName', u'PySceneDetect'),
|
41 |
| - StringStruct(u'ProductVersion', u'v0.6.3')]) |
| 66 | + StringStruct(u'ProductVersion', u'{VERSION}')]) |
42 | 67 | ]),
|
43 | 68 | VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
|
44 | 69 | ]
|
45 | 70 | )
|
| 71 | +""".encode()) |
0 commit comments