]> jfr.im git - yt-dlp.git/blame - pyinst.py
update workflow, semi fix integrated updater
[yt-dlp.git] / pyinst.py
CommitLineData
915f2a92
U
1from PyInstaller.utils.win32.versioninfo import (
2 VarStruct, VarFileInfo, StringStruct, StringTable,
3 StringFileInfo, FixedFileInfo, VSVersionInfo, SetVersion,
4)
5import PyInstaller.__main__
6
7from datetime import datetime
8
9FILE_DESCRIPTION = 'Media Downloader'
10
11exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
12
13_LATEST_VERSION = locals()['__version__']
14
15_OLD_VERSION = _LATEST_VERSION.rsplit("-", 1)
16
17if len(_OLD_VERSION) > 0:
18 old_ver = _OLD_VERSION[0]
19
20old_rev = ''
21if len(_OLD_VERSION) > 1:
22 old_rev = _OLD_VERSION[1]
23
24ver = f'{datetime.today():%Y.%m.%d}'
25rev = ''
26
27if old_ver == ver:
28 if old_rev:
29 rev = int(old_rev) + 1
30 else:
31 rev = 1
32
33_SEPARATOR = '-'
34
35version = _SEPARATOR.join(filter(None, [ver, str(rev)]))
36
37print(version)
38
39version_list = ver.split(".")
40_year, _month, _day = [int(value) for value in version_list]
41_rev = 0
42if rev:
43 _rev = rev
44_ver_tuple = _year, _month, _day, _rev
45
46version_file = VSVersionInfo(
47 ffi=FixedFileInfo(
48 filevers=_ver_tuple,
49 prodvers=_ver_tuple,
50 mask=0x3F,
51 flags=0x0,
52 OS=0x4,
53 fileType=0x1,
54 subtype=0x0,
55 date=(0, 0),
56 ),
57 kids=[
58 StringFileInfo(
59 [
60 StringTable(
61 "040904B0",
62 [
63 StringStruct("Comments", "Youtube-dlc Command Line Interface."),
64 StringStruct("CompanyName", "theidel@uni-bremen.de"),
65 StringStruct("FileDescription", FILE_DESCRIPTION),
66 StringStruct("FileVersion", version),
67 StringStruct("InternalName", "youtube-dlc"),
68 StringStruct(
69 "LegalCopyright",
70 "theidel@uni-bremen.de | UNLICENSE",
71 ),
72 StringStruct("OriginalFilename", "youtube-dlc.exe"),
73 StringStruct("ProductName", "Youtube-dlc"),
74 StringStruct("ProductVersion", version + " | git.io/JUGsM"),
75 ],
76 )
77 ]
78 ),
79 VarFileInfo([VarStruct("Translation", [0, 1200])])
80 ]
81)
82
83PyInstaller.__main__.run([
84 '--name=youtube-dlc',
85 '--onefile',
86 '--icon=win/icon/cloud.ico',
87 'youtube_dlc/__main__.py',
88])
89SetVersion('dist/youtube-dlc.exe', version_file)