aboutsummaryrefslogtreecommitdiffstats
path: root/pyinst.py
diff options
context:
space:
mode:
authorJesus <heckyel@riseup.net>2023-09-04 01:37:13 +0800
committerJesus <heckyel@riseup.net>2023-09-04 01:37:13 +0800
commit52d97967fb3b196759c19ae40a4c63dbb2557a19 (patch)
treec49e561914d2d01f2ef022443d304728a08dac25 /pyinst.py
parenta9d0affcff8d499212852d9c711112b29defe612 (diff)
parent2301b5c1b77a65abbb46b72f91e1e4666fd5d985 (diff)
downloadhypervideo-pre-52d97967fb3b196759c19ae40a4c63dbb2557a19.tar.lz
hypervideo-pre-52d97967fb3b196759c19ae40a4c63dbb2557a19.tar.xz
hypervideo-pre-52d97967fb3b196759c19ae40a4c63dbb2557a19.zip
update from upstream
Diffstat (limited to 'pyinst.py')
-rw-r--r--pyinst.py32
1 files changed, 6 insertions, 26 deletions
diff --git a/pyinst.py b/pyinst.py
index 4373b9e15..c36f6acd4 100644
--- a/pyinst.py
+++ b/pyinst.py
@@ -37,7 +37,7 @@ def main():
'--icon=devscripts/logo.ico',
'--upx-exclude=vcruntime140.dll',
'--noconfirm',
- *dependency_options(),
+ '--additional-hooks-dir=yt_dlp/__pyinstaller',
*opts,
'yt_dlp/__main__.py',
]
@@ -77,30 +77,6 @@ def version_to_list(version):
return list(map(int, version_list)) + [0] * (4 - len(version_list))
-def dependency_options():
- # Due to the current implementation, these are auto-detected, but explicitly add them just in case
- dependencies = [pycryptodome_module(), 'mutagen', 'brotli', 'certifi', 'websockets']
- excluded_modules = ('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts')
-
- yield from (f'--hidden-import={module}' for module in dependencies)
- yield '--collect-submodules=websockets'
- yield from (f'--exclude-module={module}' for module in excluded_modules)
-
-
-def pycryptodome_module():
- try:
- import Cryptodome # noqa: F401
- except ImportError:
- try:
- import Crypto # noqa: F401
- print('WARNING: Using Crypto since Cryptodome is not available. '
- 'Install with: pip install pycryptodome', file=sys.stderr)
- return 'Crypto'
- except ImportError:
- pass
- return 'Cryptodome'
-
-
def set_version_info(exe, version):
if OS_NAME == 'win32':
windows_set_version(exe, version)
@@ -109,7 +85,6 @@ def set_version_info(exe, version):
def windows_set_version(exe, version):
from PyInstaller.utils.win32.versioninfo import (
FixedFileInfo,
- SetVersion,
StringFileInfo,
StringStruct,
StringTable,
@@ -118,6 +93,11 @@ def windows_set_version(exe, version):
VSVersionInfo,
)
+ try:
+ from PyInstaller.utils.win32.versioninfo import SetVersion
+ except ImportError: # Pyinstaller >= 5.8
+ from PyInstaller.utils.win32.versioninfo import write_version_info_to_executable as SetVersion
+
version_list = version_to_list(version)
suffix = MACHINE and f'_{MACHINE}'
SetVersion(exe, VSVersionInfo(