Publish Source Available licenses and remove Mutagen in YouTubeDL 1.4.7 / helper 1.3.3
This commit is contained in:
1 parent
71a808b298
commit
50457bc35b
27 files changed
+201
-58
No files matched your search
@@ -0,0 +1,41 @@
|
||||
"""Python dependencies used by the helper; optional cover tagging is excluded."""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.metadata
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def requirements(yt_dlp="yt-dlp>=2026.8.19", ejs="yt-dlp-ejs"):
|
||||
return [yt_dlp, ejs, "brotli", "certifi", "pycryptodomex",
|
||||
"requests>=2.32.2,<3", "urllib3>=2,<3", "websockets>=13"]
|
||||
|
||||
|
||||
def validate_metadata(records):
|
||||
"""Reject strong copyleft Python libraries before activating a bundle.
|
||||
|
||||
FFmpeg is a separately executed program, so this policy concerns Python
|
||||
libraries loaded into the helper process, not the FFmpeg distribution.
|
||||
"""
|
||||
for metadata in records:
|
||||
name = re.sub(r"[-_.]+", "-", metadata.get("name", "").lower())
|
||||
licenses = [metadata.get("license_expression") or "", metadata.get("license") or "",
|
||||
*metadata.get("classifier", [])]
|
||||
incompatible = name == "mutagen" or any(
|
||||
re.search(r"(?<![A-Z])(?:A?GPL)(?:[-\s\dv]|$)|GNU (?:Affero )?General Public License",
|
||||
license, re.IGNORECASE) for license in licenses)
|
||||
if incompatible:
|
||||
raise ValueError(f"Python-пакет {name} требует отдельной проверки совместимости лицензии; комплект не изменён.")
|
||||
|
||||
|
||||
def validate_installed(directory: Path):
|
||||
records = []
|
||||
for distribution in importlib.metadata.distributions(path=[str(directory)]):
|
||||
metadata = distribution.metadata
|
||||
records.append({"name": metadata.get("Name", ""),
|
||||
"license_expression": metadata.get("License-Expression", ""),
|
||||
"license": metadata.get("License", ""),
|
||||
"classifier": metadata.get_all("Classifier") or []})
|
||||
validate_metadata(records)
|
||||
return {distribution.metadata["Name"]: distribution.version
|
||||
for distribution in importlib.metadata.distributions(path=[str(directory)])}
|
||||
Reference in new issue
Block a user