build script change for env and stuff

This commit is contained in:
thw 2026-11-14 23:46:57 +01:00
parent 22a308021d
commit c08e2e17fd
1 changed files with 22 additions and 8 deletions

View File

@ -39,20 +39,34 @@ if ! command -v python3 >/dev/null 2>&1; then
exit 1
fi
# Automatische Installation von python3-venv / python3-tk auf Linux/Ubuntu/Debian falls fehlend
if [[ "${OS_NAME}" == "linux" ]]; then
if ! python3 -c "import venv" >/dev/null 2>&1; then
echo "[INFO] Python venv Modul fehlt. Versuche automatische Installation..."
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update && sudo apt-get install -y python3-venv python3-tk || true
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y python3-virtualenv python3-tkinter || true
elif command -v pacman >/dev/null 2>&1; then
sudo pacman -S --noconfirm python-virtualenv tk || true
fi
fi
fi
if ! python3 -c "import tkinter" >/dev/null 2>&1; then
echo "[ERROR] Das Python-Modul 'tkinter' fehlt auf diesem Build-System."
echo " Debian/Ubuntu/ChromeOS: sudo apt update && sudo apt install -y python3-tk"
echo " Fedora: sudo dnf install -y python3-tkinter"
echo " Arch: sudo pacman -S tk"
echo " macOS (Homebrew): brew install python-tk"
exit 1
echo "[WARNING] Das Python-Modul 'tkinter' scheint zu fehlen."
echo " Bitte installieren: z.B. 'sudo apt install python3-tk' (Debian/Ubuntu/ChromeOS)"
fi
# Isolierte Build-Venv anlegen & Dependencies automatisch installieren
VENV_DIR="${PROJECT_ROOT}/.venv_build_${OS_NAME}"
if [[ ! -d "${VENV_DIR}" ]]; then
echo "[1/3] Erstelle isolierte Build-Umgebung (${VENV_DIR})..."
python3 -m venv "${VENV_DIR}"
if ! python3 -m venv "${VENV_DIR}"; then
echo "[ERROR] Konnte die virtuelle Umgebung nicht erstellen."
echo " Bitte installiere manuell: sudo apt install python3-venv (Ubuntu/Debian/ChromeOS)"
exit 1
fi
fi
# shellcheck disable=SC1091
@ -116,7 +130,7 @@ chmod +x "${DIST_DIR}/${APP_NAME}" 2>/dev/null || true
rm -rf "${WORK_DIR}"
echo ""
echo "[DONE] Fertige ausführbare Datei liegt bereit unter:"
echo "[DONE] Fertige ausführbare Datei liegt bereit under:"
echo " dist/${OS_NAME}/${APP_NAME}"
# Optionaler Cross-Build via Wine (falls --all übergeben wurde und Wine + Python installiert ist)