Remove Python 3.8 support (#11321)

Closes #10086
Authored by: bashonly
This commit is contained in:
bashonly
2024-10-23 06:33:50 +00:00
committed by GitHub
parent dd2e244469
commit d784464399
14 changed files with 120 additions and 75 deletions

View File

@@ -1,8 +1,8 @@
import sys
if sys.version_info < (3, 8):
if sys.version_info < (3, 9):
raise ImportError(
f'You are using an unsupported version of Python. Only Python versions 3.8 and above are supported by yt-dlp') # noqa: F541
f'You are using an unsupported version of Python. Only Python versions 3.9 and above are supported by yt-dlp') # noqa: F541
__license__ = 'The Unlicense'

View File

@@ -57,7 +57,7 @@ def passthrough_module(parent, child, allowed_attributes=(..., ), *, callback=la
callback(attr)
return ret
@functools.lru_cache(maxsize=None)
@functools.cache
def from_child(attr):
nonlocal child
if attr not in allowed_attributes:

View File

@@ -5,8 +5,3 @@ from .compat_utils import passthrough_module
passthrough_module(__name__, 'functools')
del passthrough_module
try:
_ = cache # >= 3.9
except NameError:
cache = lru_cache(maxsize=None)

View File

@@ -1,5 +1,6 @@
import functools
from .common import InfoExtractor
from ..compat import functools
from ..utils import (
int_or_none,
parse_duration,

View File

@@ -1,4 +1,5 @@
import contextlib
import functools
import importlib
import importlib.abc
import importlib.machinery
@@ -13,7 +14,6 @@ import zipimport
from pathlib import Path
from zipfile import ZipFile
from .compat import functools # isort: split
from .utils import (
Config,
get_executable_path,

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import atexit
import contextlib
import functools
import hashlib
import json
import os
@@ -12,7 +13,6 @@ import sys
from dataclasses import dataclass
from zipimport import zipimporter
from .compat import functools # isort: split
from .compat import compat_realpath
from .networking import Request
from .networking.exceptions import HTTPError, network_exceptions
@@ -135,7 +135,7 @@ def _get_binary_name():
def _get_system_deprecation():
MIN_SUPPORTED, MIN_RECOMMENDED = (3, 8), (3, 9)
MIN_SUPPORTED, MIN_RECOMMENDED = (3, 9), (3, 9)
if sys.version_info > MIN_RECOMMENDED:
return None
@@ -146,18 +146,6 @@ def _get_system_deprecation():
if sys.version_info < MIN_SUPPORTED:
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'):
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)
return None
return f'Support for Python version {major}.{minor} has been deprecated. {PYTHON_MSG}'

View File

@@ -9,6 +9,7 @@ import datetime as dt
import email.header
import email.utils
import errno
import functools
import hashlib
import hmac
import html.entities
@@ -44,7 +45,6 @@ import xml.etree.ElementTree
from . import traversal
from ..compat import functools # isort: split
from ..compat import (
compat_etree_fromstring,
compat_expanduser,