Skip to content

Commit

Permalink
Better build batch
Browse files Browse the repository at this point in the history
  • Loading branch information
filak committed Dec 17, 2024
1 parent 4a9f538 commit 74bb8ed
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 191 deletions.
104 changes: 104 additions & 0 deletions flask-app/!!build__dist_pyinstaller.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
@echo off
setlocal
echo.
set python=venv\Scripts\pyinstaller.exe

echo.
choice /C AN /M "Activate Python VENV ? A/N"
if errorlevel 2 goto:start

echo.
echo Activating VENV
call venv\Scripts\activate

:start
echo.
choice /C AN /M "Clean build ? A/N"
if errorlevel 1 set buildClean=--clean
if errorlevel 2 set buildClean=

choice /C AN /M "Test run ? A/N"
if errorlevel 1 set testRun=1
if errorlevel 2 set testRun=0

echo Build using pyinstaller : %python%

set srcDir=application
set targetDir=dist
set subdir=
set logFile=!build_dist_pyinstaller.rep

echo.
echo Cleaning static files %targetDir% ...
RMDIR %targetDir%\static /S /Q
RMDIR %targetDir%\templates /S /Q
MKDIR %targetDir%\static
MKDIR %targetDir%\templates

echo.
echo Copying files from: static, templates ...
xcopy %srcDir%\static %targetDir%\static /E /Q /Y
xcopy %srcDir%\templates %targetDir%\templates /E /Q /Y

echo. > %logFile%

set fileHandle=mtw-server
set extras=--add-data %srcDir%/pyuca/*.txt;pyuca
set subdir=
call:buildFiles

set fileHandle=mtw-worker
set extras=--add-data %srcDir%/pyuca/*.txt;pyuca
set subdir=
call:buildFiles

set fileHandle=set-mtw-admin
set extras=
set subdir=
call:buildFiles

set fileHandle=mesh-nt2trx
set extras=
set subdir=tools\
call:buildFiles

set fileHandle=mesh-trx2nt
set extras=
set subdir=tools\
call:buildFiles

set fileHandle=mesh-xml2trx
set extras=
set subdir=tools\
call:buildFiles

echo.
echo Finished !!!
echo.

title Finished building!
goto:eof

:buildFiles
set srcFile=%subdir%%fileHandle%.py
echo.
echo Building %srcFile%
title Building %srcFile%

CALL %python% --log-level ERROR --onefile %extras% --distpath %targetDir%\%subdir% %srcFile% %buildClean% >> %logFile% 2>&1

if %testRun%==1 call:runTestHelp
goto:eof

:runTestHelp
echo.
set binFile=%subdir%%fileHandle%.exe
echo Running %targetDir%\%binFile% ...
CALL %targetDir%\%binFile% -h
echo.
echo Done.
echo.
goto:eof

endlocal

57 changes: 0 additions & 57 deletions flask-app/!!build__mtw-server.bat

This file was deleted.

58 changes: 0 additions & 58 deletions flask-app/!!build__mtw-tools.bat

This file was deleted.

42 changes: 0 additions & 42 deletions flask-app/!!build__mtw-worker.bat

This file was deleted.

34 changes: 0 additions & 34 deletions flask-app/!!build__set-mtw-admin.bat

This file was deleted.

0 comments on commit 74bb8ed

Please sign in to comment.