-
Notifications
You must be signed in to change notification settings - Fork 13
Build windows installer
Building a Windows installer of D-Genies is done in two times:
- First, python part of D-Genies is packaged as a standalone executable with
pyinstaller
(this way,python
is not needed on targeted systems) - Second,
Inno Setup
is used to package D-Genies and manage its installation process.
mkdir win_build
cp -rp win32 win_build/
cp -rp src/dgenies/{templates,static,md} win_build/win32/data/dgenies/
cp -p src/bin/dgenies win_build/win32/dgeniesexe.py
In this cookbook, we have used wine-staging-7.0-rc2, but most version of wine must be OK.
cd win_build
export WINEPREFIX="${PWD}/.wine-pyinstall"
WINEARCH="win32" winecfg
We check that Wine is configured as Windows 7 and click OK
TODO:
- automated installation in cli
- installation as system wide instead of user? - correct paths
- reboot wine bottle/prefix? (waringin when installing python modules)
- add UPX?
Starting version 3.9, python is only compatible with Windows 8.1+. Python 3.8 is the last compatible with Windows 7+, our target. Moreover, python 3.8.11+ has no windows binary. We get the 3.8.10 for x86 (32 bits). In future, we wil drop Windows 7.
wget https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe
wget https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe
chmod +x python-3.8.10.exe
./python-3.8.10.exe
- Check Add Python to PATH & Choose customize installation.
- Untick documentation & tcl/tk and IDLE option. py launcher can be also removed. click Next
- check "Add python to environment variables', untick 'Associate files with Python', create shortcuts for installed applications'. Click Install
"${WINE_PREFIX}/drive_c/users/$(whoami)/AppData/Local/Programs/Python/Python38-32/python.exe" -m pip install dgenies
"${WINE_PREFIX}/drive_c/users/$(whoami)/AppData/Local/Programs/Python/Python38-32/python.exe" -m pip install pyinstaller
Done with Inno Setup 6.2
# Last version can be downloaded at https://jrsoftware.org/download.php/is.exe
# We use a stable link here for reproductibility.
wget https://files.jrsoftware.org/is/6/innosetup-6.2.0.exe -O is.exe
chmod +x is.exe
./is.exe
cd win32
"${WINE_PREFIX}/drive_c/users/$(whoami)/AppData/Local/Programs/Python/Python38-32/Scripts/pyinstaller.exe" --icon=data/logo.ico --clean dgeniesrun.py
"${WINE_PREFIX}/drive_c/users/$(whoami)/drive_c/Program\ Files/Inno\ Setup\ 6/ISCC.exe" build_setup.iss
Installer is in Output
directory and can be copied where you want:
cp Output/dgenies-*.exe ../
Original author: Floréal Cabanettes (@florealcab)
Download the win32 folder of the repository.
Add in data/dgenies/templates
folder of the win32 folder all files contained in the src/dgenies/templates
folder of the dgenies repository.
Add in data/dgenies/static
folder of the win32 folder all files and folders contained in the src/dgenies/static
folder of the dgenies repository.
Add in data/dgenies/md
folder of the win32 folder all files and folders contained in the src/dgenies/md
folder of the dgenies repository.
Copy the src/bin/dgenies
script from the dgenies repository to the win32 folder and rename it dgeniesexe.py
.
Start by installing dgenies:
pip install dgenies
Then, install pyinstaller, which will create the executable for windows:
pip install pyinstaller
You will also need Inno Setup to build setup file. We use the 5.9 version.
Into the win32 folder, run the following command.
Command:
pyinstaller --icon=data/logo.ico --clean dgeniesrun.py
This will create a dist
folder with inside a dgeniesrun
folder. Other folders will be created, but you can delete them.
Launch build of the build_setup.iss file with InnoSetup. It will create the EXE setup file inside the new Output folder.