67 lines
1.9 KiB
Bash
67 lines
1.9 KiB
Bash
#!/bin/bash
|
|
# GasFlux Web API - Build executable with PyInstaller
|
|
# This script builds a standalone executable using Waitress WSGI server
|
|
|
|
echo "Building GasFlux Web API executable..."
|
|
|
|
# Check if PyInstaller is installed
|
|
if ! python3 -c "import PyInstaller" 2>/dev/null; then
|
|
echo "Error: PyInstaller is not installed. Please run:"
|
|
echo "pip install pyinstaller waitress"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if Waitress is installed
|
|
if ! python3 -c "import waitress" 2>/dev/null; then
|
|
echo "Error: Waitress is not installed. Please run:"
|
|
echo "pip install waitress"
|
|
exit 1
|
|
fi
|
|
|
|
# Create dist directory if it doesn't exist
|
|
mkdir -p dist
|
|
|
|
echo "Creating executable with PyInstaller..."
|
|
|
|
# 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 [ $? -ne 0 ]; then
|
|
echo "Error: Failed to build executable"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Build completed successfully!"
|
|
echo "Executable created: dist/GasFluxAPI"
|
|
echo ""
|
|
echo "To run the server:"
|
|
echo "./dist/GasFluxAPI"
|
|
echo ""
|
|
echo "The server will start on http://localhost:5000" |