A feature-rich command-line audio/video downloader
Raise minimum recommended Python version to 3.9 (#11098)
bashonlycca534cd9e68
diff --git a/devscripts/changelog_override.json b/devscripts/changelog_override.jsonindex 5189de2d77..7be750cfbe 100644--- a/devscripts/changelog_override.json+++ b/devscripts/changelog_override.json@@ -185,5 +185,10 @@"action": "add","when": "6075a029dba70a89675ae1250e7cdfd91f0eba41","short": "[priority] Security: [[ie/douyutv] Do not use dangerous javascript source/URL](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-3v33-3wmw-3785)\n - A dependency on potentially malicious third-party JavaScript code has been removed from the Douyu extractors"+ },+ {+ "action": "add",+ "when": "fb8b7f226d251e521a89b23c415e249e5b788e5c",+ "short": "[priority] **The minimum *recommended* Python version has been raised to 3.9**\nSince Python 3.8 will reach end-of-life in October 2024, support for it will be dropped soon. [Read more](https://github.com/yt-dlp/yt-dlp/issues/10086)"}]diff --git a/yt_dlp/update.py b/yt_dlp/update.pyindex 72ae290844..4cf3bdc320 100644--- a/yt_dlp/update.py+++ b/yt_dlp/update.py@@ -135,20 +135,42 @@ def _get_binary_name():def _get_system_deprecation():- MIN_SUPPORTED, MIN_RECOMMENDED = (3, 8), (3, 8)+ MIN_SUPPORTED, MIN_RECOMMENDED = (3, 8), (3, 9)if sys.version_info > MIN_RECOMMENDED:return Nonemajor, minor = sys.version_info[:2]+ PYTHON_MSG = f'Please update to Python {".".join(map(str, MIN_RECOMMENDED))} or above'+if sys.version_info < MIN_SUPPORTED:- msg = f'Python version {major}.{minor} is no longer supported'- else:- msg = (f'Support for Python version {major}.{minor} has been deprecated. '- '\nYou may stop receiving updates on this version at any time')+ return f'Python version {major}.{minor} is no longer supported! {PYTHON_MSG}'++ EXE_MSG_TMPL = ('Support for {} has been deprecated. '+ 'See https://github.com/yt-dlp/yt-dlp/{} for details.\n{}')+ STOP_MSG = 'You may stop receiving updates on this version at any time!'+ variant = detect_variant()++ # Temporary until Windows builds use 3.9, which will drop support for Win7 and 2008ServerR2+ if variant in ('win_exe', 'win_x86_exe', 'py2exe'):+ platform_name = platform.platform()+ if any(platform_name.startswith(f'Windows-{name}') for name in ('7', '2008ServerR2')):+ return EXE_MSG_TMPL.format('Windows 7/Server 2008 R2', 'issues/10086', STOP_MSG)+ elif variant == 'py2exe':+ return EXE_MSG_TMPL.format(+ 'py2exe builds (yt-dlp_min.exe)', 'issues/10087',+ 'In a future update you will be migrated to the PyInstaller-bundled executable. '+ 'This will be done automatically; no action is required on your part')+ return None++ # Temporary until aarch64/armv7l build flow is bumped to Ubuntu 20.04 and Python 3.9+ elif variant in ('linux_aarch64_exe', 'linux_armv7l_exe'):+ libc_ver = version_tuple(os.confstr('CS_GNU_LIBC_VERSION').partition(' ')[2])+ if libc_ver < (2, 31):+ return EXE_MSG_TMPL.format('system glibc version < 2.31', 'pull/8638', STOP_MSG)+ return None- major, minor = MIN_RECOMMENDED- return f'{msg}! Please update to Python {major}.{minor} or above'+ return f'Support for Python version {major}.{minor} has been deprecated. {PYTHON_MSG}'def _sha256_file(path):