]>
jfr.im git - yt-dlp.git/blob - pyinst.py
4 from __future__
import unicode_literals
9 from PyInstaller
.utils
.hooks
import collect_submodules
10 from PyInstaller
.utils
.win32
.versioninfo
import (
11 VarStruct
, VarFileInfo
, StringStruct
, StringTable
,
12 StringFileInfo
, FixedFileInfo
, VSVersionInfo
, SetVersion
,
14 import PyInstaller
.__main
__
16 arch
= sys
.argv
[1] if len(sys
.argv
) > 1 else platform
.architecture()[0][:2]
17 assert arch
in ('32', '64')
18 print('Building %sbit version' % arch
)
19 _x86
= '_x86' if arch
== '32' else ''
21 FILE_DESCRIPTION
= 'yt-dlp%s' % (' (32 Bit)' if _x86
else '')
23 # root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
24 # print('Changing working directory to %s' % root_dir)
27 exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec'))
28 VERSION
= locals()['__version__']
30 VERSION_LIST
= VERSION
.split('.')
31 VERSION_LIST
= list(map(int, VERSION_LIST
)) + [0] * (4 - len(VERSION_LIST
))
33 print('Version: %s%s' % (VERSION
, _x86
))
34 print('Remember to update the version using devscipts\\update-version.py')
36 VERSION_FILE
= VSVersionInfo(
38 filevers
=VERSION_LIST
,
39 prodvers
=VERSION_LIST
,
51 StringStruct('Comments', 'yt-dlp%s Command Line Interface.' % _x86
),
52 StringStruct('CompanyName', 'https://github.com/yt-dlp'),
53 StringStruct('FileDescription', FILE_DESCRIPTION
),
54 StringStruct('FileVersion', VERSION
),
55 StringStruct('InternalName', 'yt-dlp%s' % _x86
),
58 'pukkandan.ytdlp@gmail.com | UNLICENSE',
60 StringStruct('OriginalFilename', 'yt-dlp%s.exe' % _x86
),
61 StringStruct('ProductName', 'yt-dlp%s' % _x86
),
64 '%s%s on Python %s' % (VERSION
, _x86
, platform
.python_version())),
66 VarFileInfo([VarStruct('Translation', [0, 1200])])
70 dependancies
= ['Crypto', 'mutagen'] + collect_submodules('websockets')
71 excluded_modules
= ['test', 'ytdlp_plugins', 'youtube-dl', 'youtube-dlc']
73 PyInstaller
.__main
__.run([
74 '--name=yt-dlp%s' % _x86
,
76 '--icon=devscripts/logo.ico',
77 *[f
'--exclude-module={module}' for module
in excluded_modules
],
78 *[f
'--hidden-import={module}' for module
in dependancies
],
79 '--upx-exclude=vcruntime140.dll',
82 SetVersion('dist/yt-dlp%s.exe' % _x86
, VERSION_FILE
)