Skip to content

Commit

Permalink
Now building executable from a clone repo
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Apr 9, 2024
1 parent 9dbb172 commit 38577f3
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions scripts/build_exe.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,41 @@ REM (see PythonQwt LICENSE file for more details)
REM ======================================================
call %~dp0utils GetScriptPath SCRIPTPATH
call %FUNC% GetLibName LIBNAME
set ROOTPATH=%SCRIPTPATH%\..\
call %FUNC% SetPythonPath
call %FUNC% UsePython
call %FUNC% GetVersion VERSION
set REPODIR=%SCRIPTPATH%\..

@REM Keep this around for Qt hooks debugging (the output must not be empty):
@REM %PYTHON% -c "from PyInstaller.utils.hooks import qt; print(qt.pyqt5_library_info.location)"

@REM Clone repository in a temporary directory
set CLONEDIR=%REPODIR%\..\%LIBNAME%-tempdir
if exist %CLONEDIR% ( rmdir /s /q %CLONEDIR% )
git clone -l -s . %CLONEDIR%
pushd %CLONEDIR%

@REM Generating icon
set INKSCAPE_PATH="C:\Program Files\Inkscape\bin\inkscape.exe"
set RESPATH=%ROOTPATH%resources
set RESPATH=%CLONEDIR%\resources
for %%s in (16 24 32 48 128 256) do (
%INKSCAPE_PATH% "%RESPATH%\%LIBNAME%.svg" -o "%RESPATH%\tmp-%%s.png" -w %%s -h %%s
)
magick convert "%RESPATH%\tmp-*.png" "%RESPATH%\%LIBNAME%.ico"
del "%RESPATH%\tmp-*.png"

@REM Building executable
call %FUNC% SetPythonPath
call %FUNC% UsePython
call %FUNC% GetVersion VERSION
pyinstaller %LIBNAME%.spec --noconfirm --clean
cd dist
"C:\Program Files\7-Zip\7z.exe" a -mx1 "%LIBNAME%-v%VERSION%_exe.zip" %LIBNAME%
set ZIPNAME=%LIBNAME%-v%VERSION%_exe.zip
"C:\Program Files\7-Zip\7z.exe" a -mx1 "%ZIPNAME%" %LIBNAME%
popd

if not exist %REPODIR%\dist ( mkdir %REPODIR%\dist )
@REM Move zipped executable to dist directory
move %CLONEDIR%\dist\%ZIPNAME% %REPODIR%\dist
@REM Move generated folder to dist directory
move %CLONEDIR%\dist\%LIBNAME% %REPODIR%\dist

rmdir /s /q %CLONEDIR%
call %FUNC% EndOfScript

0 comments on commit 38577f3

Please sign in to comment.