Files
UAV-CO2/build_exe.bat
2026-04-20 09:43:21 +08:00

74 lines
2.0 KiB
Batchfile

@echo off
REM GasFlux Web API - Build executable with PyInstaller
REM This script builds a standalone executable using Waitress WSGI server
echo Building GasFlux Web API executable...
REM Check if PyInstaller is installed
python -c "import PyInstaller" >nul 2>&1
if errorlevel 1 (
echo Error: PyInstaller is not installed. Please run:
echo pip install pyinstaller waitress
pause
exit /b 1
)
REM Check if Waitress is installed
python -c "import waitress" >nul 2>&1
if errorlevel 1 (
echo Error: Waitress is not installed. Please run:
echo pip install waitress
pause
exit /b 1
)
REM Create dist directory if it doesn't exist
if not exist "dist" mkdir dist
echo Creating executable with PyInstaller...
REM Build the executable
pyinstaller --onefile ^
--name GasFluxAPI ^
--hidden-import waitress ^
--hidden-import flask ^
--hidden-import werkzeug ^
--hidden-import yaml ^
--hidden-import pandas ^
--hidden-import numpy ^
--hidden-import flask_cors ^
--hidden-import psutil ^
--hidden-import skgstat ^
--hidden-import skgstat.Variogram ^
--hidden-import skgstat.OrdinaryKriging ^
--add-data "src\gasflux\gasflux_config.yaml;src\gasflux" ^
--add-data "API_DOCUMENTATION.md;." ^
--hidden-import matplotlib ^
--hidden-import matplotlib.pyplot ^
--hidden-import matplotlib.backends ^
--hidden-import matplotlib.backends.backend_agg ^
--hidden-import matplotlib.figure ^
--hidden-import matplotlib.axes ^
--hidden-import matplotlib.lines ^
--hidden-import matplotlib.patches ^
--hidden-import matplotlib.text ^
--hidden-import matplotlib.transforms ^
--exclude-module tkinter ^
server_waitress.py
if errorlevel 1 (
echo Error: Failed to build executable
pause
exit /b 1
)
echo.
echo Build completed successfully!
echo Executable created: dist\GasFluxAPI.exe
echo.
echo To run the server:
echo GasFluxAPI.exe
echo.
echo The server will start on http://localhost:5000
echo.
pause