File: version_setup.py

package info (click to toggle)
lightyears 1.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,804 kB
  • sloc: python: 5,532; sh: 39; makefile: 6
file content (68 lines) | stat: -rw-r--r-- 2,258 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

import time
from lib20k.primitives import VERSION

VERSION3 = '{}.{}.{}'.format(*VERSION)
VERSION4 = VERSION3 + ".0"
VERSION4T = tuple(list(VERSION) + [0])
YEAR = str(time.localtime().tm_year)

open("version.nsh", "wt").write(f"""
!define VERSION4 {VERSION4}
!define VERSION3 {VERSION3}
!define YEAR {YEAR}

VIAddVersionKey /LANG=0 "ProductName" "20K Light Years Into Space"
VIAddVersionKey /LANG=0 "CompanyName" "Jack Whitham"
VIAddVersionKey /LANG=0 "FileDescription" "20K Light Years Into Space Installer"
VIAddVersionKey /LANG=0 "LegalCopyright" "(C) Jack Whitham 2006-{YEAR}"
VIAddVersionKey /LANG=0 "FileVersion" "{VERSION4}"
VIAddVersionKey /LANG=0 "ProductVersion" "{VERSION4}"
VIProductVersion {VERSION4}
VIFileVersion {VERSION4}
OutFile "dist\install-20kly-v{VERSION3}.exe"

""")

open("version.txt", "wt", encoding="utf-8").write(f"""# 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={VERSION4T},
    prodvers={VERSION4T},
    # Contains a bitmask that specifies the valid bits 'flags'r
    mask=0x0,
    # 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'000004b0',
        [StringStruct(u'CompanyName', u'Jack Whitham'),
        StringStruct(u'FileDescription', u'20K Light Years Into Space'),
        StringStruct(u'FileVersion', u'{VERSION4}'),
        StringStruct(u'LegalCopyright', u'(C) Jack Whitham 2006-{YEAR}'),
        StringStruct(u'ProductName', u'20K Light Years Into Space'),
        StringStruct(u'ProductVersion', u'{VERSION4}')])
      ]), 
    VarFileInfo([VarStruct(u'Translation', [0, 1200])])
  ]
)
""")