]> jfr.im git - yt-dlp.git/blame - pyinst.py
[skip travis] typo
[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
25ver = f'{datetime.today():%Y.%m.%d}'
26rev = ''
27
28if old_ver == ver:
29 if old_rev:
30 rev = int(old_rev) + 1
31 else:
32 rev = 1
33
34_SEPARATOR = '-'
35
36version = _SEPARATOR.join(filter(None, [ver, str(rev)]))
37
38print(version)
39
40version_list = ver.split(".")
41_year, _month, _day = [int(value) for value in version_list]
42_rev = 0
43if rev:
44 _rev = rev
45_ver_tuple = _year, _month, _day, _rev
46
47version_file = VSVersionInfo(
48 ffi=FixedFileInfo(
49 filevers=_ver_tuple,
50 prodvers=_ver_tuple,
51 mask=0x3F,
52 flags=0x0,
53 OS=0x4,
54 fileType=0x1,
55 subtype=0x0,
56 date=(0, 0),
57 ),
58 kids=[
59 StringFileInfo(
60 [
61 StringTable(
62 "040904B0",
63 [
64 StringStruct("Comments", "Youtube-dlc Command Line Interface."),
65 StringStruct("CompanyName", "theidel@uni-bremen.de"),
66 StringStruct("FileDescription", FILE_DESCRIPTION),
67 StringStruct("FileVersion", version),
68 StringStruct("InternalName", "youtube-dlc"),
69 StringStruct(
70 "LegalCopyright",
71 "theidel@uni-bremen.de | UNLICENSE",
72 ),
73 StringStruct("OriginalFilename", "youtube-dlc.exe"),
74 StringStruct("ProductName", "Youtube-dlc"),
75 StringStruct("ProductVersion", version + " | git.io/JUGsM"),
76 ],
77 )
78 ]
79 ),
80 VarFileInfo([VarStruct("Translation", [0, 1200])])
81 ]
82)
83
84PyInstaller.__main__.run([
85 '--name=youtube-dlc',
86 '--onefile',
87 '--icon=win/icon/cloud.ico',
88 'youtube_dlc/__main__.py',
89])
90SetVersion('dist/youtube-dlc.exe', version_file)