From 962ffcf89c8d935410391fbea3580688aafe76d7 Mon Sep 17 00:00:00 2001 From: crazymoose77756 <52980616+crazymoose77756@users.noreply.github.com> Date: Sun, 26 Jun 2022 20:50:06 -0400 Subject: [cleanup] Fix some typos (#4194) Authored by: crazymoose77756 --- pyinst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pyinst.py') diff --git a/pyinst.py b/pyinst.py index a7c1be85d..a8c8dd7b7 100644 --- a/pyinst.py +++ b/pyinst.py @@ -44,7 +44,7 @@ def main(): def parse_options(): - # Compatability with older arguments + # Compatibility with older arguments opts = sys.argv[1:] if opts[0:1] in (['32'], ['64']): if ARCH != opts[0]: -- cgit v1.2.3 From 5200976949b93bc937a95d4453985e5e1a1160e2 Mon Sep 17 00:00:00 2001 From: odo2063 Date: Sat, 16 Jul 2022 18:22:48 +0200 Subject: [build] Fix architecture suffix of executables (#4355) Authored by: odo2063 --- pyinst.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'pyinst.py') diff --git a/pyinst.py b/pyinst.py index a8c8dd7b7..55df1a78f 100644 --- a/pyinst.py +++ b/pyinst.py @@ -6,7 +6,11 @@ import sys from PyInstaller.__main__ import run as run_pyinstaller -OS_NAME, ARCH = sys.platform, platform.architecture()[0][:2] +OS_NAME, MACHINE = sys.platform, platform.machine() +if MACHINE in ('x86_64', 'amd64'): + MACHINE = '' +elif 'i' in MACHINE and '86' in MACHINE: + MACHINE = 'x86' def main(): @@ -18,7 +22,7 @@ def main(): opts.append('--onefile') name, final_file = exe(onedir) - print(f'Building yt-dlp v{version} {ARCH}bit for {OS_NAME} with options {opts}') + print(f'Building yt-dlp v{version} for {OS_NAME} {platform.machine()} with options {opts}') print('Remember to update the version using "devscripts/update-version.py"') if not os.path.isfile('yt_dlp/extractor/lazy_extractors.py'): print('WARNING: Building without lazy_extractors. Run ' @@ -47,6 +51,7 @@ def parse_options(): # Compatibility with older arguments opts = sys.argv[1:] if opts[0:1] in (['32'], ['64']): + ARCH = platform.architecture()[0][:2] if ARCH != opts[0]: raise Exception(f'{opts[0]}bit executable cannot be built on a {ARCH}bit system') opts = opts[1:] @@ -65,7 +70,7 @@ def exe(onedir): name = '_'.join(filter(None, ( 'yt-dlp', {'win32': '', 'darwin': 'macos'}.get(OS_NAME, OS_NAME), - ARCH == '32' and 'x86' + MACHINE ))) return name, ''.join(filter(None, ( 'dist/', @@ -122,7 +127,7 @@ def windows_set_version(exe, version): ) version_list = version_to_list(version) - suffix = '_x86' if ARCH == '32' else '' + suffix = MACHINE and f'_{MACHINE}' SetVersion(exe, VSVersionInfo( ffi=FixedFileInfo( filevers=version_list, @@ -136,9 +141,9 @@ def windows_set_version(exe, version): ), kids=[ StringFileInfo([StringTable('040904B0', [ - StringStruct('Comments', 'yt-dlp%s Command Line Interface.' % suffix), + StringStruct('Comments', 'yt-dlp%s Command Line Interface' % suffix), StringStruct('CompanyName', 'https://github.com/yt-dlp'), - StringStruct('FileDescription', 'yt-dlp%s' % (' (32 Bit)' if ARCH == '32' else '')), + StringStruct('FileDescription', 'yt-dlp%s' % (MACHINE and f' ({MACHINE})')), StringStruct('FileVersion', version), StringStruct('InternalName', f'yt-dlp{suffix}'), StringStruct('LegalCopyright', 'pukkandan.ytdlp@gmail.com | UNLICENSE'), -- cgit v1.2.3 From d08e1e68758d5041afa79abd6a2d7dd1c45879d8 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sun, 17 Jul 2022 16:41:40 +0530 Subject: Fix bug in 5200976949b93bc937a95d4453985e5e1a1160e2 --- pyinst.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'pyinst.py') diff --git a/pyinst.py b/pyinst.py index 55df1a78f..526e8802f 100644 --- a/pyinst.py +++ b/pyinst.py @@ -6,11 +6,10 @@ import sys from PyInstaller.__main__ import run as run_pyinstaller -OS_NAME, MACHINE = sys.platform, platform.machine() -if MACHINE in ('x86_64', 'amd64'): - MACHINE = '' -elif 'i' in MACHINE and '86' in MACHINE: - MACHINE = 'x86' +OS_NAME, MACHINE, ARCH = sys.platform, platform.machine(), platform.architecture()[0][:2] +if MACHINE in ('x86_64', 'AMD64') or ('i' in MACHINE and '86' in MACHINE): + # NB: Windows x86 has MACHINE = AMD64 irrespective of bitness + MACHINE = 'x86' if ARCH == '32' else '' def main(): @@ -51,7 +50,6 @@ def parse_options(): # Compatibility with older arguments opts = sys.argv[1:] if opts[0:1] in (['32'], ['64']): - ARCH = platform.architecture()[0][:2] if ARCH != opts[0]: raise Exception(f'{opts[0]}bit executable cannot be built on a {ARCH}bit system') opts = opts[1:] -- cgit v1.2.3 From f5e438a976dcf8d7d263631ea0b0bf114b6182af Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sun, 17 Jul 2022 18:45:43 +0530 Subject: [compat] Let PyInstaller detect _legacy module --- pyinst.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'pyinst.py') diff --git a/pyinst.py b/pyinst.py index 526e8802f..31854e881 100644 --- a/pyinst.py +++ b/pyinst.py @@ -33,9 +33,6 @@ def main(): '--icon=devscripts/logo.ico', '--upx-exclude=vcruntime140.dll', '--noconfirm', - # NB: Modules that are only imported dynamically must be added here. - # --collect-submodules may not work correctly if user has a yt-dlp installed via PIP - '--hidden-import=yt_dlp.compat._legacy', *dependency_options(), *opts, 'yt_dlp/__main__.py', -- cgit v1.2.3 From 115add43876964956917bf596c1d0b148c5b3c26 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 9 Aug 2022 01:08:47 +0530 Subject: [devscripts] Create `utils` and refactor --- pyinst.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'pyinst.py') diff --git a/pyinst.py b/pyinst.py index 31854e881..9be5d8960 100644 --- a/pyinst.py +++ b/pyinst.py @@ -1,11 +1,17 @@ #!/usr/bin/env python3 +# Allow direct execution import os -import platform import sys +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +import platform + from PyInstaller.__main__ import run as run_pyinstaller +from devscripts.utils import read_version + OS_NAME, MACHINE, ARCH = sys.platform, platform.machine(), platform.architecture()[0][:2] if MACHINE in ('x86_64', 'AMD64') or ('i' in MACHINE and '86' in MACHINE): # NB: Windows x86 has MACHINE = AMD64 irrespective of bitness @@ -13,8 +19,7 @@ if MACHINE in ('x86_64', 'AMD64') or ('i' in MACHINE and '86' in MACHINE): def main(): - opts = parse_options() - version = read_version('yt_dlp/version.py') + opts, version = parse_options(), read_version() onedir = '--onedir' in opts or '-D' in opts if not onedir and '-F' not in opts and '--onefile' not in opts: @@ -53,13 +58,6 @@ def parse_options(): return opts -# Get the version from yt_dlp/version.py without importing the package -def read_version(fname): - with open(fname, encoding='utf-8') as f: - exec(compile(f.read(), fname, 'exec')) - return locals()['__version__'] - - def exe(onedir): """@returns (name, path)""" name = '_'.join(filter(None, ( -- cgit v1.2.3 From 460eb9c50e0970fdceb51485c5fe3268574c48e8 Mon Sep 17 00:00:00 2001 From: Lesmiscore Date: Mon, 15 Aug 2022 15:43:43 +0900 Subject: [build] Exclude devscripts from installs Closes #4667 --- pyinst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pyinst.py') diff --git a/pyinst.py b/pyinst.py index 9be5d8960..0b7c66a30 100644 --- a/pyinst.py +++ b/pyinst.py @@ -81,7 +81,7 @@ def version_to_list(version): 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 = ['test', 'ytdlp_plugins', 'youtube_dl', 'youtube_dlc'] + excluded_modules = ('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts') yield from (f'--hidden-import={module}' for module in dependencies) yield '--collect-submodules=websockets' -- cgit v1.2.3 From 17fc3dc48af968e28c23197ed06542fdb47aba2b Mon Sep 17 00:00:00 2001 From: MrOctopus Date: Fri, 11 Nov 2022 02:49:24 +0100 Subject: [build] Create armv7l and aarch64 releases (#5449) Closes #5436 Authored by: MrOctopus, pukkandan --- pyinst.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pyinst.py') diff --git a/pyinst.py b/pyinst.py index 0b7c66a30..17c950563 100644 --- a/pyinst.py +++ b/pyinst.py @@ -12,9 +12,8 @@ from PyInstaller.__main__ import run as run_pyinstaller from devscripts.utils import read_version -OS_NAME, MACHINE, ARCH = sys.platform, platform.machine(), platform.architecture()[0][:2] -if MACHINE in ('x86_64', 'AMD64') or ('i' in MACHINE and '86' in MACHINE): - # NB: Windows x86 has MACHINE = AMD64 irrespective of bitness +OS_NAME, MACHINE, ARCH = sys.platform, platform.machine().lower(), platform.architecture()[0][:2] +if MACHINE in ('x86', 'x86_64', 'amd64', 'i386', 'i686'): MACHINE = 'x86' if ARCH == '32' else '' @@ -63,7 +62,7 @@ def exe(onedir): name = '_'.join(filter(None, ( 'yt-dlp', {'win32': '', 'darwin': 'macos'}.get(OS_NAME, OS_NAME), - MACHINE + MACHINE, ))) return name, ''.join(filter(None, ( 'dist/', -- cgit v1.2.3