@echo off
if exist build      rmdir /s /q build
if exist dist       rmdir /s /q dist
if exist __pycache__ rmdir /s /q __pycache__
if exist *.spec del /q *.spec


cd /d "%~dp0"

where python >nul 2>&1
if %errorlevel% neq 0 (
    where py >nul 2>&1
    if %errorlevel% neq 0 (
        echo Python nicht gefunden!
        pause
        exit /b 1
    )
    set PYTHON=py
) else (
    set PYTHON=python
)

%PYTHON% -m PyInstaller ^
 --clean ^
 --noconfirm ^
 --onefile ^
 --windowed ^
 --name Signatur-Assistent ^
 main.py

pause
copy .\dist\*.exe

if exist build      rmdir /s /q build
if exist dist       rmdir /s /q dist
if exist __pycache__ rmdir /s /q __pycache__
if exist *.spec del /q *.spec
