aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/update.py
diff options
context:
space:
mode:
authorSimon Sawicki <contact@grub4k.xyz>2023-09-24 02:24:47 +0200
committerGitHub <noreply@github.com>2023-09-24 02:24:47 +0200
commit61bdf15fc7400601c3da1aa7a43917310a5bf391 (patch)
tree61661d25b39c6cfd9845422b778d9efd5cf86faf /yt_dlp/update.py
parent1eaca74bc2ca0f5b1ec532f24c61de44f2e8cb2d (diff)
[core] Raise minimum recommended Python version to 3.8 (#8183)
Authored by: Grub4K
Diffstat (limited to 'yt_dlp/update.py')
-rw-r--r--yt_dlp/update.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/yt_dlp/update.py b/yt_dlp/update.py
index d708b09e3..db79df127 100644
--- a/yt_dlp/update.py
+++ b/yt_dlp/update.py
@@ -112,6 +112,31 @@ def is_non_updateable():
detect_variant(), _NON_UPDATEABLE_REASONS['unknown' if VARIANT else 'other'])
+def _get_system_deprecation():
+ MIN_SUPPORTED, MIN_RECOMMENDED = (3, 7), (3, 8)
+
+ if sys.version_info > MIN_RECOMMENDED:
+ return None
+
+ major, minor = sys.version_info[:2]
+ 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. '
+ # Temporary until `win_x86_exe` uses 3.8, which will deprecate Vista and Server 2008
+ if detect_variant() == 'win_x86_exe':
+ platform_name = platform.platform()
+ if any(platform_name.startswith(f'Windows-{name}') for name in ('Vista', '2008Server')):
+ msg = 'Support for Windows Vista/Server 2008 has been deprecated. '
+ else:
+ return None
+ msg += ('See https://github.com/yt-dlp/yt-dlp/issues/7803 for details.'
+ '\nYou may stop receiving updates on this version at any time')
+
+ major, minor = MIN_RECOMMENDED
+ return f'{msg}! Please update to Python {major}.{minor} or above'
+
+
def _sha256_file(path):
h = hashlib.sha256()
mv = memoryview(bytearray(128 * 1024))