Package the portable DSH profiles, local plugins, desktop integration, Firefox wrapper, and ownership-aware installer lifecycle. Bundle checksum-pinned OpenVSCode, editor extensions, translation assets, and cloudflared so unreliable upstream artifact downloads cannot break a clean installation.
27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
import hashlib
|
|
import json
|
|
import zipfile
|
|
from pathlib import Path
|
|
|
|
repository = Path(__file__).resolve().parent.parent
|
|
records = []
|
|
for line in (repository / "manifests" / "vscode-extension-artifacts.tsv").read_text().strip().splitlines():
|
|
specification, relative, expected_hash = line.split("\t")
|
|
archive = repository / relative
|
|
actual_hash = hashlib.sha256(archive.read_bytes()).hexdigest()
|
|
if actual_hash != expected_hash:
|
|
raise RuntimeError(f"Checksum mismatch: {relative}")
|
|
with zipfile.ZipFile(archive) as package:
|
|
manifest = json.loads(package.read("extension/package.json"))
|
|
identity = f"{manifest['publisher']}.{manifest['name']}@{manifest['version']}".lower()
|
|
if identity != specification.lower():
|
|
raise RuntimeError(f"Identity mismatch: {relative}")
|
|
license_present = any(Path(name).name.lower().startswith("license") for name in package.namelist())
|
|
if specification.startswith("dsh-local."):
|
|
license_present = "MIT License" in (repository / "LICENSE").read_text()
|
|
if not license_present:
|
|
raise RuntimeError(f"License missing: {relative}")
|
|
records.append(specification)
|
|
if len(records) != len(set(records)):
|
|
raise RuntimeError("Duplicate editor extension identity")
|
|
print("editor artifact test passed")
|