ZaStoGram/Tools/check_plugin_python_deps.py
loop-uh a8e12dd75a Proxy lifecycle ownership, plugin infra, editable forwarding
Implement proxy lifecycle ownership model distinguishing visible from health-only events based on socket role and origin; add configGeneration for FakeTLS budget state independent of activation lifecycle; introduce resume grace period masking for stale phases during app foreground transitions.

Centralize proxy link parsing into ProxyLinkHelper with clipboard extraction; add clipboard proxy alert on app resume.

Expand plugin infrastructure with text formatting, structured settings, Android/client utilities, and UI bridge for settings screens.

Introduce EditableForwardDraft for caption editing and album/separate-post grouping modes in message forwarding.

Add video frame capture feature for PhotoViewer and PeerStoriesView with gallery save support.

Increase socket role tracking through proxy connection event pipeline for distinguishing control/media/background traffic in diagnostics.

Update proxy check guards and runtime log verifiers to enforce lifecycle ownership boundaries and new architectural constraints.
2026-07-04 17:38:27 +03:00

63 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Guard the bundled Python packages expected by common exteraGram plugins."""
from __future__ import annotations
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
BUILD_GRADLE = ROOT / "TMessagesProj" / "build.gradle"
REQUIRED_PACKAGES = {
"beautifulsoup4": "common HTML parsing library listed by exteraGram",
"debugpy": "debug adapter listed by exteraGram for plugin development",
"lxml": "common XML/HTML parser listed by exteraGram",
"packaging": "version parsing dependency used by common plugin libraries",
"Pillow": "provides PIL for image-processing plugins",
"PyYAML": "YAML parser listed by exteraGram",
"pyfiglet": "used by ASCII art generator plugins",
"requests": "used by networked plugin helpers",
}
def fail(message: str) -> int:
print("Plugin Python dependency guard failed:", file=sys.stderr)
print(f"- {message}", file=sys.stderr)
return 1
def installed_packages(gradle_text: str) -> set[str]:
packages: set[str] = set()
for match in re.finditer(r'(?m)^[ \t]*install[ \t]+"([^"]+)"', gradle_text):
packages.add(match.group(1))
return packages
def main() -> int:
try:
gradle_text = BUILD_GRADLE.read_text(encoding="utf-8")
except FileNotFoundError:
return fail(f"Missing {BUILD_GRADLE.relative_to(ROOT)}")
found = installed_packages(gradle_text)
missing = [
f"{package} ({reason})"
for package, reason in REQUIRED_PACKAGES.items()
if package not in found
]
if missing:
print("Plugin Python dependency guard failed:", file=sys.stderr)
for item in missing:
print(f"- Missing Chaquopy pip dependency: {item}", file=sys.stderr)
return 1
print("Plugin Python dependency guard passed")
return 0
if __name__ == "__main__":
sys.exit(main())