mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-10-24 01:09:42 -07:00
Remove Python 3.10 support (#17160)
* Also upgrade Windows builds to Python 3.14 Closes #16916, Closes #16917 Authored by: bashonly, doe1080, Grub4K Co-authored-by: doe1080 <98906116+doe1080@users.noreply.github.com> Co-authored-by: Simon Sawicki <contact@grub4k.dev>
This commit is contained in:
co-authored by
doe1080
Simon Sawicki
parent
6ccd977303
commit
3d28cf4780
+1
-53
@@ -1,17 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import contextlib
|
||||
import datetime as dt
|
||||
import functools
|
||||
import itertools
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
|
||||
def read_file(fname):
|
||||
@@ -36,7 +27,7 @@ def calculate_version(version=None, fname='yt_dlp/version.py'):
|
||||
return version
|
||||
|
||||
revision = version
|
||||
version = dt.datetime.now(dt.timezone.utc).strftime('%Y.%m.%d')
|
||||
version = dt.datetime.now(dt.UTC).strftime('%Y.%m.%d')
|
||||
|
||||
if revision:
|
||||
assert re.fullmatch(r'[0-9]+', revision), 'Revision must be numeric'
|
||||
@@ -73,46 +64,3 @@ def run_process(*args, **kwargs):
|
||||
kwargs.setdefault('encoding', 'utf-8')
|
||||
kwargs.setdefault('errors', 'replace')
|
||||
return subprocess.run(args, **kwargs)
|
||||
|
||||
|
||||
def request(url: str, *, headers: dict | None = None):
|
||||
req = urllib.request.Request(url, headers=headers or {})
|
||||
return contextlib.closing(urllib.request.urlopen(req))
|
||||
|
||||
|
||||
def call_github_api(path: str, *, query: dict | None = None) -> dict | list:
|
||||
API_BASE_URL = 'https://api.github.com/'
|
||||
assert not path.startswith(('https://', 'http://')) or path.startswith(API_BASE_URL)
|
||||
|
||||
url = urllib.parse.urlparse(urllib.parse.urljoin(API_BASE_URL, path))
|
||||
qs = urllib.parse.urlencode({
|
||||
**urllib.parse.parse_qs(url.query),
|
||||
**(query or {}),
|
||||
}, True)
|
||||
|
||||
headers = {
|
||||
'Accept': 'application/vnd.github+json',
|
||||
'User-Agent': 'yt-dlp',
|
||||
'X-GitHub-Api-Version': '2026-03-10',
|
||||
}
|
||||
if gh_token := os.getenv('GH_TOKEN'):
|
||||
headers['Authorization'] = f'Bearer {gh_token}'
|
||||
|
||||
with request(urllib.parse.urlunparse(url._replace(query=qs)), headers=headers) as resp:
|
||||
return json.load(resp)
|
||||
|
||||
|
||||
def zipf_files_and_folders(zipf: zipfile.ZipFile, glob: str = '*') -> tuple[list[str], list[str]]:
|
||||
files = []
|
||||
folders = []
|
||||
|
||||
path = zipfile.Path(zipf)
|
||||
for f in itertools.chain(path.glob(glob), path.rglob(glob)):
|
||||
if not f.is_file():
|
||||
continue
|
||||
files.append(f.at) # type: ignore[attr-defined]
|
||||
folder = f.parent.at.rstrip('/') # type: ignore[attr-defined]
|
||||
if folder and folder not in folders:
|
||||
folders.append(folder)
|
||||
|
||||
return files, folders
|
||||
|
||||
Reference in New Issue
Block a user