# PPTX Image Compressor – Installation Logic ## 1. Intro – One Line Summary > The script selects the best available Python environment, falls back to a self-installed embedded runtime if necessary, ensures `pip`, installs `svg-polish` when possible, and runs the application with graceful degradation. ## 2. Lightweight Overview ```text START │ ├─► Find usable Python │ ├─ venv (active / local) │ ├─ system Python │ └─ fallback: download embedded Python │ ├─► Ensure pip works │ ├─ pip exists → OK │ ├─ ensurepip → try fix │ └─ get-pip.py → fallback fix │ ├─► Install dependency │ └─ svg-polish (optional but preferred) │ ├─► Run main script │ └─► END ``` --- ## 3. Detailed Logic Tree ```text START │ ├─► [A] Pre-check: caesiumclt │ ├─ found → continue │ └─ not found → EXIT │ ├─► [B] Python resolution (priority-based) │ │ │ ├─ Active venv (VIRTUAL_ENV)? │ │ └─ use it ✅ │ │ │ ├─ Local ".venv"? │ │ └─ use it ✅ │ │ │ ├─ Local "venv"? │ │ └─ use it ✅ │ │ │ ├─ System Python (python.exe, excluding WindowsApps)? │ │ └─ use it ✅ │ │ │ ├─ Python launcher (py.exe)? │ │ └─ use py -3 ✅ │ │ │ ├─ Existing embedded Python? │ │ └─ use it ✅ │ │ │ └─ NONE FOUND → │ ├─ Download embeddable Python │ ├─ Extract to python-embed │ ├─ Fix isolation (enable "import site") │ └─ use it ✅ │ ├─► [C] Validate main script exists │ ├─ missing → EXIT │ └─ exists → continue │ ├─► [D] Ensure pip availability │ │ │ ├─ pip works? │ │ └─ YES → continue ✅ │ │ │ └─ NO → │ ├─ try: ensurepip │ │ ├─ success → ✅ │ │ └─ fail → │ │ │ └─ if embedded Python: │ ├─ download get-pip.py │ ├─ execute it │ ├─ remove file │ └─ re-check pip │ │ ├─ still no pip → │ │ └─ WARN: disable SVG compression │ │ │ └─ pip available → │ ✅ continue │ ├─► [E] Install dependency │ ├─ install svg-polish │ │ ├─ success → ✅ SVG enabled │ │ └─ fail → ⚠ SVG disabled │ │ │ └─ optional debug: pip list │ ├─► [F] Run application │ ├─ execute Python script │ ├─ capture return code │ ├─ success → "Fertig" │ └─ error → report exit code │ └─► END ```