Files
LibrarySystem/installer.bat
2024-10-08 13:36:52 +02:00

77 lines
2.5 KiB
Batchfile

@echo off
echo print Installing Python 3.12.7
echo downloading..... please wait
curl -o python-3.12.7-amd64.exe https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe
echo Installing Python 3.12.7
python-3.12.7-amd64.exe /quiet InstallAllUsers=0 PrependPath=1 Include_test=0
echo Python 3.12.7 installed
echo Please confirm the installation by opening a new terminal and typing python --version
echo If the version is 3.12.7, then the installation was successful
pause
echo downloading the repository
curl -o LibrarySystem.zip https://git.theprivateserver.de/WorldTeacher/LibrarySystem/archive/main.zip
echo Extracting the repository
tar -xf LibrarySystem.zip
cd into the extracted folder
cd librarysystem
echo Installing the required packages
python -m venv venv
call venv\Scripts\activate.bat
echo Activated the virtual environment
echo Cleaning up the environment
@echo off
echo Uninstalling all Python packages...
@REM Uninstall all packages in the virtual environment
pip freeze > temp_requirements.txt
for /F "delims=" %%i in (temp_requirements.txt) do pip uninstall -y %%i
@REM Clean up the temporary file
del temp_requirements.txt
echo All packages uninstalled.
echo Installing the required packages
pip install -r requirements.txt
echo Installation completed
echo Building the application
call pyinstaller --noconfirm --onedir --windowed --icon "icons/icon.ico" --name "LibrarySystem" --clean --add-data "config;config/" --add-data "icons;icons/" "main.py"
echo compiling done, please confirm the build by checking the dist folder
echo If the build is successful, you can run the application by running the LibrarySystem.exe file in the folder
pause
set /p compile="Build successful? (y/n) "
if %compile% == y (
echo Build successful
exit
) else (
echo Build failed
echo switching over to manual mode using auto-py-to-exe
echo installing auto-py-to-exe
pip install auto-py-to-exe
echo auto-py-to-exe installed
echo running auto-py-to-exe
echo --------------------
echo Please go to settings > Import config.json
echo Select the build.app.json
echo Change / Set these values:
echo - Script Location: main.py
echo - Icon: icons/icon.ico
echo - Additional Files:
echo - config: config/
echo - icons: icons/
echo - site: site/
echo Click on the Convert .py to .exe button
echo the completed build will be in the output folder
echo --------------------
call auto-py-to-exe
pause
)