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
+4
-1
@@ -19,6 +19,7 @@ from urllib.parse import urlsplit
|
||||
import requests
|
||||
from host.bundle import ROOT, installation_root, manifest
|
||||
from host.media import NO_WINDOW, run_small
|
||||
from host.python_packages import requirements, validate_metadata, validate_installed
|
||||
|
||||
ALLOWED_HOSTS = {"www.python.org", "nodejs.org", "api.github.com", "github.com", "release-assets.githubusercontent.com", "objects.githubusercontent.com", "pypi.org", "files.pythonhosted.org"}
|
||||
FFMPEG_ASSET = "ffmpeg-master-latest-win64-gpl-shared.zip"
|
||||
@@ -183,11 +184,12 @@ def resolve_packages(stage, work, progress):
|
||||
report = work / "python-packages.json"
|
||||
script = "import sys;sys.path.insert(0,sys.argv.pop(1));from pip._internal.cli.main import main;raise SystemExit(main(sys.argv[1:]))"
|
||||
command = [str(stage / "runtime/python/python.exe"), "-I", "-X", "utf8", "-B", "-c", script, str(pip), "--isolated", "--disable-pip-version-check", "install",
|
||||
"--dry-run", "--ignore-installed", "--only-binary=:all:", "--no-cache-dir", "--quiet", "--report", str(report), "--index-url", "https://pypi.org/simple", "yt-dlp[default]", "yt-dlp-ejs"]
|
||||
"--dry-run", "--ignore-installed", "--only-binary=:all:", "--no-cache-dir", "--quiet", "--report", str(report), "--index-url", "https://pypi.org/simple", *requirements()]
|
||||
result = subprocess.run(command, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=600, creationflags=NO_WINDOW,
|
||||
env={**os.environ, "TEMP": str(work), "TMP": str(work)}, stdin=subprocess.DEVNULL)
|
||||
if result.returncode: raise ValueError("Не удалось подобрать совместимые Python-пакеты. " + result.stderr[-1200:])
|
||||
records = json.loads(report.read_text(encoding="utf-8"))["install"]
|
||||
validate_metadata([record["metadata"] for record in records])
|
||||
packages = stage / "runtime/python/Lib/site-packages"
|
||||
if packages.exists(): shutil.rmtree(packages)
|
||||
packages.mkdir(parents=True)
|
||||
@@ -206,6 +208,7 @@ def resolve_packages(stage, work, progress):
|
||||
if packages.resolve() not in destination.parents: raise ValueError("Некорректный путь Python-пакета.")
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
destination.write_bytes(wheel.read(member))
|
||||
validate_installed(packages)
|
||||
return {item["metadata"]["name"]: item["metadata"]["version"] for item in records}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user