]>
Commit | Line | Data |
---|---|---|
ff88a05c | 1 | #!/usr/bin/env python |
2 | # coding: utf-8 | |
3 | ||
e38df8f9 | 4 | from __future__ import unicode_literals |
5 | import sys | |
b3943b2f | 6 | # import os |
ff88a05c | 7 | import platform |
e38df8f9 | 8 | |
9 | from PyInstaller.utils.win32.versioninfo import ( | |
10 | VarStruct, VarFileInfo, StringStruct, StringTable, | |
11 | StringFileInfo, FixedFileInfo, VSVersionInfo, SetVersion, | |
12 | ) | |
13 | import PyInstaller.__main__ | |
14 | ||
ff88a05c | 15 | arch = sys.argv[1] if len(sys.argv) > 1 else platform.architecture()[0][:2] |
16 | assert arch in ('32', '64') | |
17 | print('Building %sbit version' % arch) | |
18 | _x86 = '_x86' if arch == '32' else '' | |
e38df8f9 | 19 | |
ff88a05c | 20 | FILE_DESCRIPTION = 'Media Downloader%s' % (' (32 Bit)' if _x86 else '') |
e38df8f9 | 21 | |
b3943b2f | 22 | # root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) |
23 | # print('Changing working directory to %s' % root_dir) | |
24 | # os.chdir(root_dir) | |
e38df8f9 | 25 | |
7a5c1cfe | 26 | exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec')) |
e38df8f9 | 27 | VERSION = locals()['__version__'] |
28 | ||
3dd264bf | 29 | VERSION_LIST = VERSION.split('.') |
e38df8f9 | 30 | VERSION_LIST = list(map(int, VERSION_LIST)) + [0] * (4 - len(VERSION_LIST)) |
31 | ||
32 | print('Version: %s%s' % (VERSION, _x86)) | |
33 | print('Remember to update the version using devscipts\\update-version.py') | |
34 | ||
35 | VERSION_FILE = VSVersionInfo( | |
36 | ffi=FixedFileInfo( | |
37 | filevers=VERSION_LIST, | |
38 | prodvers=VERSION_LIST, | |
39 | mask=0x3F, | |
40 | flags=0x0, | |
41 | OS=0x4, | |
42 | fileType=0x1, | |
43 | subtype=0x0, | |
44 | date=(0, 0), | |
45 | ), | |
46 | kids=[ | |
47 | StringFileInfo([ | |
48 | StringTable( | |
ff88a05c | 49 | '040904B0', [ |
7a5c1cfe P |
50 | StringStruct('Comments', 'yt-dlp%s Command Line Interface.' % _x86), |
51 | StringStruct('CompanyName', 'https://github.com/yt-dlp'), | |
ff88a05c | 52 | StringStruct('FileDescription', FILE_DESCRIPTION), |
53 | StringStruct('FileVersion', VERSION), | |
7a5c1cfe | 54 | StringStruct('InternalName', 'yt-dlp%s' % _x86), |
e38df8f9 | 55 | StringStruct( |
ff88a05c | 56 | 'LegalCopyright', |
7a5c1cfe | 57 | 'pukkandan.ytdlp@gmail.com | UNLICENSE', |
e38df8f9 | 58 | ), |
7a5c1cfe P |
59 | StringStruct('OriginalFilename', 'yt-dlp%s.exe' % _x86), |
60 | StringStruct('ProductName', 'yt-dlp%s' % _x86), | |
b3943b2f | 61 | StringStruct('ProductVersion', '%s%s' % (VERSION, _x86)), |
e38df8f9 | 62 | ])]), |
ff88a05c | 63 | VarFileInfo([VarStruct('Translation', [0, 1200])]) |
e38df8f9 | 64 | ] |
65 | ) | |
66 | ||
67 | PyInstaller.__main__.run([ | |
7a5c1cfe | 68 | '--name=yt-dlp%s' % _x86, |
e38df8f9 | 69 | '--onefile', |
70 | '--icon=devscripts/cloud.ico', | |
71 | '--exclude-module=youtube_dl', | |
e58c22a0 | 72 | '--exclude-module=youtube_dlc', |
e38df8f9 | 73 | '--exclude-module=test', |
74 | '--exclude-module=ytdlp_plugins', | |
75 | '--hidden-import=mutagen', | |
44f705d0 | 76 | '--hidden-import=Crypto', |
46261325 | 77 | '--upx-exclude=vcruntime140.dll', |
7a5c1cfe | 78 | 'yt_dlp/__main__.py', |
e38df8f9 | 79 | ]) |
7a5c1cfe | 80 | SetVersion('dist/yt-dlp%s.exe' % _x86, VERSION_FILE) |