]>
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
= platform
.architecture()[0][:2]
17 assert arch
in ('32', '64')
18 _x86
= '_x86' if arch
== '32' else ''
20 # Compatability with older arguments
22 if opts
[0:1] in (['32'], ['64']):
24 raise Exception(f
'{opts[0]}bit executable cannot be built on a {arch}bit system')
26 opts
= opts
or ['--onefile']
28 print(f
'Building {arch}bit version with options {opts}')
30 FILE_DESCRIPTION
= 'yt-dlp%s' % (' (32 Bit)' if _x86
else '')
32 # root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
33 # print('Changing working directory to %s' % root_dir)
36 exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec'))
37 VERSION
= locals()['__version__']
39 VERSION_LIST
= VERSION
.split('.')
40 VERSION_LIST
= list(map(int, VERSION_LIST
)) + [0] * (4 - len(VERSION_LIST
))
42 print('Version: %s%s' % (VERSION
, _x86
))
43 print('Remember to update the version using devscipts\\update-version.py')
45 VERSION_FILE
= VSVersionInfo(
47 filevers
=VERSION_LIST
,
48 prodvers
=VERSION_LIST
,
60 StringStruct('Comments', 'yt-dlp%s Command Line Interface.' % _x86
),
61 StringStruct('CompanyName', 'https://github.com/yt-dlp'),
62 StringStruct('FileDescription', FILE_DESCRIPTION
),
63 StringStruct('FileVersion', VERSION
),
64 StringStruct('InternalName', 'yt-dlp%s' % _x86
),
67 'pukkandan.ytdlp@gmail.com | UNLICENSE',
69 StringStruct('OriginalFilename', 'yt-dlp%s.exe' % _x86
),
70 StringStruct('ProductName', 'yt-dlp%s' % _x86
),
73 '%s%s on Python %s' % (VERSION
, _x86
, platform
.python_version())),
75 VarFileInfo([VarStruct('Translation', [0, 1200])])
79 dependancies
= ['Cryptodome', 'mutagen'] + collect_submodules('websockets')
80 excluded_modules
= ['test', 'ytdlp_plugins', 'youtube-dl', 'youtube-dlc']
82 PyInstaller
.__main
__.run([
83 '--name=yt-dlp%s' % _x86
,
84 '--icon=devscripts/logo.ico',
85 *[f
'--exclude-module={module}' for module
in excluded_modules
],
86 *[f
'--hidden-import={module}' for module
in dependancies
],
87 '--upx-exclude=vcruntime140.dll',
92 SetVersion('dist/%syt-dlp%s.exe' % ('yt-dlp/' if '--onedir' in opts
else '', _x86
), VERSION_FILE
)