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