-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbuild-pyinstaller.bat
More file actions
51 lines (42 loc) · 2.28 KB
/
build-pyinstaller.bat
File metadata and controls
51 lines (42 loc) · 2.28 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
@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-pyinstaller.txt
if errorlevel 1 (
echo Failed to install or update modules. Exiting.
call deactivate
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.
call deactivate
exit /b 1
)
:: Write out the executable version info
mkdir build
pyivf-make_version --outfile "build/version.rc" --version %VERSION% --file-description "MouseTracks %VERSION%" --internal-name "MouseTracks" --original-filename "MouseTracks-%VERSION%-windows-x64.exe" --product-name "MouseTracks %VERSION%" --legal-copyright "Peter Hunt" --company-name "Peter Hunt"
pyivf-make_version --outfile "build/version-installer.rc" --version %VERSION% --file-description "MouseTracks %VERSION%" --internal-name "MouseTracks" --original-filename "MouseTracks.exe" --product-name "MouseTracks %VERSION%" --legal-copyright "Peter Hunt" --company-name "Peter Hunt"
pyivf-make_version --outfile "build/version-portable.rc" --version %VERSION% --file-description "MouseTracks %VERSION%" --internal-name "MouseTracks" --original-filename "MouseTracks-%VERSION%-windows-x64-portable.exe" --product-name "MouseTracks %VERSION%" --legal-copyright "Peter Hunt" --company-name "Peter Hunt"
:: Write out the public key
python -m mousetracks2 --write-public-key
:: Build the executable and launcher
pyinstaller MouseTracks.spec
:: Sign the executables
python -m mousetracks2 --sign-executable "dist/MouseTracks.exe"
python -m mousetracks2 --sign-executable "dist/MouseTracks-%VERSION%-windows-x64.exe"
python -m mousetracks2 --sign-executable "dist/MouseTracks-%VERSION%-windows-x64-portable.exe"
:: Exit the virtual environment
call deactivate