install_and_run.bat to install svg-polish correctly in case of "new" standalone. Added requirements of packages in requirements-dev.txt and requirement.txt

This commit is contained in:
2026-06-17 10:46:39 +02:00
parent e6a8fcb963
commit 16f30e8d38
3 changed files with 34 additions and 5 deletions
+30 -5
View File
@@ -12,7 +12,7 @@ set "SELF_DIR=%~dp0"
set "SCRIPT=%SELF_DIR%pptx_image_compress.py"
rem ---- Python Embeddable config ----
set "PY_EMBED_VERSION=3.14.5"
set "PY_EMBED_VERSION=3.14.6"
set "PY_EMBED_ZIP=python-%PY_EMBED_VERSION%-embed-amd64.zip"
set "PY_EMBED_URL=https://www.python.org/ftp/python/%PY_EMBED_VERSION%/%PY_EMBED_ZIP%"
set "PY_DIR=%SELF_DIR%python-embed"
@@ -110,6 +110,14 @@ if errorlevel 1 (
)
set "PY_CMD=%PY_EXE%"
rem ---- Fix embedded Python isolation for the installation of pip ----
set "PTH_FILE=%PY_DIR%\python314._pth"
if exist "%PTH_FILE%" (
echo [INFO] Enabling site-packages in embedded Python...
powershell -Command ^
"(Get-Content '%PTH_FILE%') -replace '^#?\s*import site','import site' | Set-Content '%PTH_FILE%'"
)
:have_python
if not defined PY_CMD (
echo [ERROR] Konnte Python nicht ermitteln. Abbruch.
@@ -122,8 +130,17 @@ if not exist "%SCRIPT%" (
exit /b 6
)
set "RUN_ARGS=%*"
if "%~1"=="" set "RUN_ARGS=-h"
set "ALL_ARGS=%*"
set "RUN_ARGS=%ALL_ARGS%"
set "DEBUG_MODE=0"
if "%~1"=="--debug" (
set "DEBUG_MODE=1"
set "RUN_ARGS=!ALL_ARGS:~8!"
if "!RUN_ARGS:~0,1!"==" " set "RUN_ARGS=!RUN_ARGS:~1!"
)
if "!RUN_ARGS!"=="" set "RUN_ARGS=-h"
echo [INFO] Pruefe und installiere Python-Abhaengigkeit: svg-polish ...
set "PIP_OK=0"
@@ -165,14 +182,22 @@ if "%PIP_OK%"=="0" (
if "%PIP_OK%"=="1" (
if defined USE_PY_LAUNCHER (
"%PY_CMD%" -3 -m pip install --disable-pip-version-check --quiet svg-polish
"%PY_CMD%" -3 -m pip install --disable-pip-version-check --quiet --no-warn-script-location svg-polish
) else (
"%PY_CMD%" -m pip install --disable-pip-version-check --quiet svg-polish
"%PY_CMD%" -m pip install --disable-pip-version-check --quiet --no-warn-script-location svg-polish
)
if errorlevel 1 (
echo [WARN] 'svg-polish' konnte nicht installiert werden. SVG-Dateien werden nicht komprimiert.
) else (
echo [OK] 'svg-polish' ist verfuegbar.
if %DEBUG_MODE%==1 (
echo [DEBUG] pip list:
if defined USE_PY_LAUNCHER (
"%PY_CMD%" -3 -m pip list
) else (
"%PY_CMD%" -m pip list
)
)
)
) else (
echo [WARN] pip konnte nicht eingerichtet werden. SVG-Dateien werden nicht komprimiert.