@echo off
setlocal

echo [1/4] Configuring pip to use a domestic mirror...
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple || goto :error
pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn || goto :error

echo [2/4] Upgrading pip/setuptools/wheel...
pip install pip==24.0 setuptools==69.0.3 wheel==0.45.1 || goto :error

echo [3/4] Installing dependencies...
pip install ttkbootstrap==1.14.2 || goto :error
pip install pillow==10.4.0 || goto :error
pip install matplotlib==3.9.2 || goto :error
pip install numpy==2.0.2 || goto :error
pip install shapely==2.1.2 || goto :error
pip install colour-science==0.4.6 || goto :error
pip install pyserial==3.5 || goto :error
pip install openpyxl==3.1.5 || goto :error

echo [4/4] Installing PyInstaller...
pip install pyinstaller==6.13.0 || goto :error

echo.
echo All dependencies have been installed successfully.
goto :end

:error
echo.
echo An error occurred while installing dependencies. Please check the output above for details.
exit /b 1

:end
pause