2021-06-27 09:34:01 +00:00
@ ECHO OFF
: : --------------------------------------------------------------------------------------------------------------------------------------
2021-07-02 13:45:59 +00:00
: : project: GarageCalc Window-Exe Generator
: : summary: create a GarageCalc-executable for Windows (version with no-console-windows as well as version with console windows for traces)
2021-06-27 09:34:01 +00:00
: : file: pyinstaller.cmd
: : date: version author
: : 2021-06-27 1 paul salajean
: : --------------------------------------------------------------------------------------------------------------------------------------
2021-07-02 13:45:59 +00:00
SET version = " v0.4 "
2021-06-27 09:34:01 +00:00
SET release_dir = " D:\Temp\Prog\ownCloud\profp@uberspace\transfer "
SET prev_dir = %cd%
2021-07-02 13:45:59 +00:00
SET reinstall_venv = " false "
2021-06-27 09:34:01 +00:00
SET do_zip = " false "
CD ..
2021-07-02 13:45:59 +00:00
ECHO Creating GarageCalc Windows.exe-version in folder %cd% \dist
2021-06-27 09:34:01 +00:00
PAUSE
REM pyinstaller --noconfirm --log-level=ERROR ^
REM --onedir --nowindow ^
REM --add-data="README;." ^
REM --add-data="image1.png;img" ^
REM --add-data="img;doc;ui" ^
2021-07-02 13:45:59 +00:00
REM --add-data="LICENSE.txt;changelog.md;GarageCalc.bat" ^
2021-06-27 09:34:01 +00:00
REM --add-binary="libfoo.so;lib" ^
REM --hidden-import=secret1 ^
REM --hidden-import=secret2 ^
2021-07-02 13:45:59 +00:00
REM --icon=.\img\GarageCalc.ico ^
2021-06-27 09:34:01 +00:00
REM --debug=imports ^
REM --key=N0T1me40pp0ssum5
REM --paths=.\src ^
2021-07-02 13:45:59 +00:00
REM GarageCalc.spec
2021-06-27 09:34:01 +00:00
REM The key-string is a string of 16 characters which is used to encrypt each file of Python byte-code before it is stored in the archive inside the executable file.
REM This feature uses the "tinyaes" module internally for the encryption.
REM
: :one dir:
ECHO ...Running...
RMDIR /S /Q .\dist> nul
RMDIR /S /Q .\build> nul
: :Use Virtual env
IF %reinstall_venv% == " false " GOTO PYINSTALL
ECHO Installing virtual env as " .\env2 " ...
RMDIR /S /Q .\env2> NUL
python -m venv env2
CALL .\env2\Scripts\activate.bat
ECHO Installing necessary python packages...
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
: PYINSTALL
IF %reinstall_venv% == " false " CALL .\env2\Scripts\activate.bat
ECHO Running " pyinstaller " ...
2021-07-02 13:45:59 +00:00
REM pyinstaller .\main.py --name=GarageCalc --noconfirm --console --clean --onedir --log-level=ERROR --hidden-import=PySide2.QtXml --icon=.\img\GarageCalc.ico --add-data="LICENSE;." --add-data="README.md;." --add-data="changelog.md;." --add-data="*.ui;." --add-data="img;.\img"
REM --windowed
pyinstaller .\src\main.py --name=GarageCalc --noconfirm --windowed --clean --onefile --log-level=ERROR --hidden-import=PySide2.QtXml ^
2021-06-27 09:34:01 +00:00
--icon=.\img\icons8-garage-32.ico ^
2021-07-02 13:45:59 +00:00
--add-data=" *.txt;. " ^
--add-data=" *.md;. " ^
--add-data=" ui;.\ui " ^
--add-data=" i18n;.\i18n " ^
2021-06-27 09:34:01 +00:00
--add-data=" img;.\img "
2021-07-02 13:45:59 +00:00
: :MOVE .\dist\GarageCalc\*.md .\dist\
: :MOVE .\dist\GarageCalc\LICENSE .\dist\
2021-06-27 09:34:01 +00:00
: :clean-up img-folder
2021-07-02 13:45:59 +00:00
: :MOVE .\dist\GarageCalc\img .\dist\img>NUL
2021-06-27 09:34:01 +00:00
: :Remove temp dir and files
DEL /Q *.spec> NUL
RMDIR /S /Q .\build
: :Create self extracting archive
IF %do_zip% == " false " GOTO END
: :-mx0 = Don't compress at all - just copy the contents to archive.
: :-mx1 = Consumes least time, but compression is low.
: :-mx3 = Better than -mx1.
: :-mx5 = This is default (compression is normal).
: :-mx7 = Maximum compression.
: :-mx9 = Ultra compression.
2021-07-02 13:45:59 +00:00
" C:\Program Files\7-zip\7z.exe " a %release_dir% \GarageCalc_%version% _portable.exe -mx9 -sfx7z.sfx .\dist\*
2021-06-27 09:34:01 +00:00
: :Disable Virtual env
CALL .\env2\Scripts\deactivate.bat
: END
CD %prev_dir%
ECHO Done. Check %prev_dir% \..\dist
IF %do_zip% == " true " ECHO Done. Check %release_dir%
PAUSE