-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathbuild-nuitka.bat
More file actions
84 lines (74 loc) · 2.68 KB
/
Copy pathbuild-nuitka.bat
File metadata and controls
84 lines (74 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@echo off
:: Check the virtual environment exists
if not exist ".venv" (
echo Virtual Environment does not exist.
echo Please create it first with `python -m venv .venv` using Python 3.11 or later.
pause
exit /b 1
)
:: Enter the virtual environment
call .venv\Scripts\activate
:: Ensure pyinstaller is installed
python -m pip install --upgrade pip
python -m pip install --upgrade -r requirements.txt
python -m pip install --upgrade -r requirements-build-nuitka.txt
if errorlevel 1 (
echo Failed to install or update modules. Exiting.
exit /b 1
)
:: Retrieve the version
set PYTHON_COMMAND_TO_GET_VERSION="from mousetracks2 import __version__; print(__version__)"
for /f "delims=" %%V in ('python -c %PYTHON_COMMAND_TO_GET_VERSION% 2^>nul') do set VERSION=%%V
if not defined VERSION (
echo Failed to detect version. Exiting.
exit /b 1
)
:: Build the executable
echo --- Building Application (MouseTracks-%VERSION%-windows-x64.exe) ---
python -m nuitka ^
--standalone ^
--onefile ^
--prefer-source-code ^
--output-dir=dist ^
--output-filename=MouseTracks-%VERSION%-windows-x64.exe ^
--plugin-enable=pyside6 ^
--include-data-file=config/colours.txt=config/colours.txt ^
--include-data-file=config/AppList.txt=config/AppList.txt ^
--include-data-file=config/language/strings/en_GB.ini=config/language/strings/en_GB.ini ^
--include-data-file=config/language/keyboard/keys/en_GB.ini=config/language/keyboard/keys/en_GB.ini ^
--include-data-file=config/language/keyboard/layout/en_US.txt=config/language/keyboard/layout/en_US.txt ^
--include-data-file=resources/images/icon.png=resources/images/icon.png ^
--include-data-file=resources/fonts/liberation-sans.regular.ttf=resources/fonts/liberation-sans.regular.ttf ^
--windows-icon-from-ico=resources/images/icon.ico ^
--product-name="Mouse Tracks %VERSION%" ^
--file-description="Mouse Tracks %VERSION%" ^
--product-version=%VERSION% ^
--file-version=%VERSION% ^
--copyright="Peter Hunt" ^
launch.py
if errorlevel 1 (
echo Main application build failed.
call deactivate
exit /b 1
)
:: Build the launcher
echo --- Building Launcher (MouseTracks.exe) ---
python -m nuitka ^
--standalone ^
--onefile ^
--prefer-source-code ^
--output-dir=dist ^
--output-filename=MouseTracks.exe ^
--windows-icon-from-ico=resources/images/icon.ico ^
launcher.py
if errorlevel 1 (
echo Launcher build failed.
call deactivate
exit /b 1
)
:: Sign the executables
python -m mousetracks2 --write-public-key
python -m mousetracks2 --sign-executable "dist/MouseTracks.exe"
python -m mousetracks2 --sign-executable "dist/MouseTracks-%VERSION%-windows-x64.exe"
:: Exit the virtual environment
call deactivate