Windows: General improvements to dev scripts

This commit is contained in:
biast12 authored and DevilXD committed 2024-12-31 21:05:35 +01:00
1 parent f5690a0396
commit c2aa283c68
2 files changed
+50 -12

No files matched your search

+24 -5
View File
@@ -1,18 +1,37 @@
@echo off @echo off
cls
set dirpath=%~dp0
if "%dirpath:~-1%" == "\" set dirpath=%dirpath:~0,-1%
REM Get the directory path of the script
set "dirpath=%~dp0"
if "%dirpath:~-1%" == "\" set "dirpath=%dirpath:~0,-1%"
REM Check if the virtual environment exists
if not exist "%dirpath%\env" ( if not exist "%dirpath%\env" (
echo: echo:
echo No virtual environment found! Run setup_env.bat to set it up first. echo No virtual environment found! Run setup_env.bat to set it up first.
echo: echo:
pause pause
exit exit /b
) )
REM Check if pyinstaller and pywin32 is installed in the virtual environment
if not exist "%dirpath%\env\scripts\pyinstaller.exe" ( if not exist "%dirpath%\env\scripts\pyinstaller.exe" (
"%dirpath%\env\scripts\pip" install pyinstaller "%dirpath%\env\scripts\pip" install pyinstaller
if errorlevel 1 (
echo Failed to install pyinstaller.
exit /b 1
)
"%dirpath%\env\scripts\python" "%dirpath%\env\scripts\pywin32_postinstall.py" -install -silent "%dirpath%\env\scripts\python" "%dirpath%\env\scripts\pywin32_postinstall.py" -install -silent
if errorlevel 1 (
echo Failed to run pywin32_postinstall.py.
exit /b 1
)
) )
"%dirpath%/env/scripts/pyinstaller" "%dirpath%\build.spec"
REM Run pyinstaller with the specified build spec file
"%dirpath%\env\scripts\pyinstaller" "%dirpath%\build.spec"
if errorlevel 1 (
echo PyInstaller build failed.
exit /b 1
)
echo Build completed successfully.
+26 -7
View File
@@ -1,35 +1,54 @@
@echo off @echo off
cls
set dirpath=%~dp0
if "%dirpath:~-1%" == "\" set dirpath=%dirpath:~0,-1%
git --version > nul REM Get the directory path of the script
set "dirpath=%~dp0"
if "%dirpath:~-1%" == "\" set "dirpath=%dirpath:~0,-1%"
REM Check if git is installed
git --version > nul 2>&1
if %errorlevel% NEQ 0 ( if %errorlevel% NEQ 0 (
echo No git executable found in PATH! echo No git executable found in PATH!
echo: echo:
pause pause
exit exit /b 1
) )
REM Create the virtual environment if it doesn't exist
if not exist "%dirpath%\env" ( if not exist "%dirpath%\env" (
echo: echo:
echo Creating the env folder... echo Creating the env folder...
python -m venv "%dirpath%\env" python -m venv "%dirpath%\env"
if %errorlevel% NEQ 0 ( if %errorlevel% NEQ 0 (
echo: echo:
echo No python executable found in PATH! echo No python executable found in PATH or failed to create virtual environment!
echo: echo:
pause pause
exit /b 1
) )
) )
REM Activate the virtual environment and install requirements
echo: echo:
echo Installing requirements.txt... echo Installing requirements.txt...
"%dirpath%\env\scripts\python" -m pip install -U pip "%dirpath%\env\scripts\python" -m pip install -U pip
if %errorlevel% NEQ 0 (
echo Failed to upgrade pip.
exit /b 1
)
"%dirpath%\env\scripts\pip" install wheel "%dirpath%\env\scripts\pip" install wheel
if %errorlevel% NEQ 0 (
echo Failed to install wheel.
exit /b 1
)
"%dirpath%\env\scripts\pip" install -r "%dirpath%\requirements.txt" "%dirpath%\env\scripts\pip" install -r "%dirpath%\requirements.txt"
if %errorlevel% NEQ 0 (
echo Failed to install requirements.
exit /b 1
)
echo: echo:
echo All done! echo All done!
echo: echo:
pause pause